xref: /original-bsd/sys/vax/include/vmparam.h (revision 1a56dd2c)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)vmparam.h	7.2 (Berkeley) 11/30/87
7  */
8 
9 /*
10  * Machine dependent constants for VAX
11  */
12 /*
13  * USRTEXT is the start of the user text/data space, while USRSTACK
14  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
15  * the number of pages from the beginning of the P0 region to the
16  * beginning of the text and from the beginning of the P1 region to the
17  * beginning of the stack respectively.
18  */
19 #define	USRTEXT		0
20 #define	USRSTACK	(0x80000000-UPAGES*NBPG) /* Start of user stack */
21 #define	BTOPUSRSTACK	(0x400000 - UPAGES)	 /* btop(USRSTACK) */
22 /* number of ptes per page */
23 #define	P1PAGES		0x200000	/* number of pages in P1 region */
24 #define	LOWPAGES	0
25 #define	HIGHPAGES	UPAGES
26 
27 /*
28  * Virtual memory related constants, all in bytes
29  */
30 #ifndef MAXTSIZ
31 #define	MAXTSIZ		(6*1024*1024)		/* max text size */
32 #endif
33 #ifndef DFLDSIZ
34 #define	DFLDSIZ		(6*1024*1024)		/* initial data size limit */
35 #endif
36 #ifndef MAXDSIZ
37 #define	MAXDSIZ		(16*1024*1024)		/* max data size */
38 #endif
39 #ifndef	DFLSSIZ
40 #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
41 #endif
42 #ifndef	MAXSSIZ
43 #define	MAXSSIZ		MAXDSIZ			/* max stack size */
44 #endif
45 
46 /*
47  * Default sizes of swap allocation chunks (see dmap.h).
48  * The actual values may be changed in vminit() based on MAXDSIZ.
49  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
50  */
51 #define	DMMIN	32			/* smallest swap allocation */
52 #define	DMMAX	4096			/* largest potential swap allocation */
53 #define	DMTEXT	1024			/* swap allocation for text */
54 
55 /*
56  * Sizes of the system and user portions of the system page table.
57  */
58 /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
59 #define	SYSPTSIZE	((20+MAXUSERS)*NPTEPG)
60 #define	USRPTSIZE 	(32*NPTEPG)
61 
62 /*
63  * The size of the clock loop.
64  */
65 #define	LOOPPAGES	(maxfree - firstfree)
66 
67 /*
68  * The time for a process to be blocked before being very swappable.
69  * This is a number of seconds which the system takes as being a non-trivial
70  * amount of real time.  You probably shouldn't change this;
71  * it is used in subtle ways (fractions and multiples of it are, that is, like
72  * half of a ``long time'', almost a long time, etc.)
73  * It is related to human patience and other factors which don't really
74  * change over time.
75  */
76 #define	MAXSLP 		20
77 
78 /*
79  * A swapped in process is given a small amount of core without being bothered
80  * by the page replacement algorithm.  Basically this says that if you are
81  * swapped in you deserve some resources.  We protect the last SAFERSS
82  * pages against paging and will just swap you out rather than paging you.
83  * Note that each process has at least UPAGES+CLSIZE pages which are not
84  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
85  * number just means a swapped in process is given around 25k bytes.
86  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
87  * so we loan each swapped in process memory worth 100$, or just admit
88  * that we don't consider it worthwhile and swap it out to disk which costs
89  * $30/mb or about $0.75.
90  */
91 #define	SAFERSS		32		/* nominal ``small'' resident set size
92 					   protected against replacement */
93 
94 /*
95  * DISKRPM is used to estimate the number of paging i/o operations
96  * which one can expect from a single disk controller.
97  */
98 #define	DISKRPM		60
99 
100 /*
101  * Klustering constants.  Klustering is the gathering
102  * of pages together for pagein/pageout, while clustering
103  * is the treatment of hardware page size as though it were
104  * larger than it really is.
105  *
106  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
107  * units.  Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
108  */
109 
110 #define	KLMAX	(32/CLSIZE)
111 #define	KLSEQL	(16/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
112 #define	KLIN	(8/CLSIZE)		/* default data/stack in klust */
113 #define	KLTXT	(4/CLSIZE)		/* default text in klust */
114 #define	KLOUT	(32/CLSIZE)
115 
116 /*
117  * KLSDIST is the advance or retard of the fifo reclaim for sequential
118  * processes data space.
119  */
120 #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
121 
122 /*
123  * Paging thresholds (see vm_sched.c).
124  * Strategy of 1/19/85:
125  *	lotsfree is 512k bytes, but at most 1/4 of memory
126  *	desfree is 200k bytes, but at most 1/8 of memory
127  *	minfree is 64k bytes, but at most 1/2 of desfree
128  */
129 #define	LOTSFREE	(512 * 1024)
130 #define	LOTSFREEFRACT	4
131 #define	DESFREE		(200 * 1024)
132 #define	DESFREEFRACT	8
133 #define	MINFREE		(64 * 1024)
134 #define	MINFREEFRACT	2
135 
136 /*
137  * There are two clock hands, initially separated by HANDSPREAD bytes
138  * (but at most all of user memory).  The amount of time to reclaim
139  * a page once the pageout process examines it increases with this
140  * distance and decreases as the scan rate rises.
141  */
142 #define	HANDSPREAD	(2 * 1024 * 1024)
143 
144 /*
145  * The number of times per second to recompute the desired paging rate
146  * and poke the pagedaemon.
147  */
148 #define	RATETOSCHEDPAGING	4
149 
150 /*
151  * Believed threshold (in megabytes) for which interleaved
152  * swapping area is desirable.
153  */
154 #define	LOTSOFMEM	2
155 
156 #define	mapin(pte, v, pfnum, prot) \
157 	(*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v))
158