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