xref: /original-bsd/sys/tahoe/include/vmparam.h (revision 8df871f1)
1*8df871f1Sbostic /*-
2*8df871f1Sbostic  * Copyright (c) 1988 The Regents of the University of California.
3*8df871f1Sbostic  * All rights reserved.
46ae514e1Skarels  *
5*8df871f1Sbostic  * This code is derived from software contributed to Berkeley by
6*8df871f1Sbostic  * Computer Consoles Inc.
7*8df871f1Sbostic  *
8*8df871f1Sbostic  * %sccs.include.proprietary.c%
9*8df871f1Sbostic  *
10*8df871f1Sbostic  *	@(#)vmparam.h	7.3 (Berkeley) 05/08/91
116ae514e1Skarels  */
12ddd4a425Ssam 
13*8df871f1Sbostic /*-
1457e96b6cSsam  * Machine dependent constants for tahoe.
15ddd4a425Ssam  */
1657e96b6cSsam 
17ddd4a425Ssam /*
18ddd4a425Ssam  * USRTEXT is the start of the user text/data space, while USRSTACK
19ddd4a425Ssam  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
20ddd4a425Ssam  * the number of pages from the beginning of the P0 region to the
21ddd4a425Ssam  * beginning of the text and from the beginning of the P2 region to the
22ddd4a425Ssam  * beginning of the stack respectively.
23ddd4a425Ssam  */
24ddd4a425Ssam #define	USRTEXT		0
250b8444b9Ssam #define	USRSTACK	(0xc0000000-UPAGES*NBPG) /* Start of user stack */
260b8444b9Ssam #define	BTOPUSRSTACK	(0x300000 - UPAGES)	 /* btop(USRSTACK) */
27ddd4a425Ssam #define	P2PAGES		0x100000	/* number of pages in P2 region */
28ddd4a425Ssam #define	LOWPAGES	0
29ddd4a425Ssam #define	HIGHPAGES	UPAGES
30ddd4a425Ssam 
31ddd4a425Ssam /*
32477ef2c3Ssam  * Virtual memory related constants, all in bytes
33ddd4a425Ssam  */
34477ef2c3Ssam #define	MAXTSIZ		(6*1024*1024)		/* max text size */
350b8444b9Ssam #ifndef DFLDSIZ
36477ef2c3Ssam #define	DFLDSIZ		(6*1024*1024)		/* initial data size limit */
370b8444b9Ssam #endif
380b8444b9Ssam #ifndef MAXDSIZ
390f7249cfSsam #define	MAXDSIZ		(32*1024*1024)		/* max data size */
400b8444b9Ssam #endif
410b8444b9Ssam #ifndef	DFLSSIZ
42477ef2c3Ssam #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
430b8444b9Ssam #endif
440b8444b9Ssam #ifndef	MAXSSIZ
450b8444b9Ssam #define	MAXSSIZ		MAXDSIZ			/* max stack size */
460b8444b9Ssam #endif
470b8444b9Ssam 
480b8444b9Ssam /*
490b8444b9Ssam  * Default sizes of swap allocation chunks (see dmap.h).
500b8444b9Ssam  * The actual values may be changed in vminit() based on MAXDSIZ.
510b8444b9Ssam  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
52702aa092Smckusick  * DMMIN should be at least ctod(1) so that vtod() works.
53702aa092Smckusick  * vminit() ensures this.
540b8444b9Ssam  */
550b8444b9Ssam #define	DMMIN	32			/* smallest swap allocation */
560b8444b9Ssam #define	DMMAX	4096			/* largest potential swap allocation */
570b8444b9Ssam #define	DMTEXT	1024			/* swap allocation for text */
58ddd4a425Ssam 
59ddd4a425Ssam /*
60ddd4a425Ssam  * Sizes of the system and user portions of the system page table.
61ddd4a425Ssam  */
62ddd4a425Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
6345587f55Skarels #define	SYSPTSIZE	((20+MAXUSERS/2)*NPTEPG)
640b8444b9Ssam #define	USRPTSIZE 	(4*NPTEPG)
65ddd4a425Ssam 
66ddd4a425Ssam /*
67702aa092Smckusick  * PTEs for system V compatible shared memory.
68702aa092Smckusick  * This is basically slop for kmempt which we actually allocate (malloc) from.
69702aa092Smckusick  */
70702aa092Smckusick #define SHMMAXPGS	512
71702aa092Smckusick 
72702aa092Smckusick /*
73702aa092Smckusick  * Boundary at which to place first MAPMEM segment if not explicitly
74702aa092Smckusick  * specified.  Should be a power of two.  This allows some slop for
75702aa092Smckusick  * the data segment to grow underneath the first mapped segment.
76702aa092Smckusick  */
77702aa092Smckusick #define MMSEG		0x200000
78702aa092Smckusick 
79702aa092Smckusick /*
80ddd4a425Ssam  * The size of the clock loop.
81ddd4a425Ssam  */
82ddd4a425Ssam #define	LOOPPAGES	(maxfree - firstfree)
83ddd4a425Ssam 
84ddd4a425Ssam /*
85ddd4a425Ssam  * The time for a process to be blocked before being very swappable.
86ddd4a425Ssam  * This is a number of seconds which the system takes as being a non-trivial
87ddd4a425Ssam  * amount of real time.  You probably shouldn't change this;
88ddd4a425Ssam  * it is used in subtle ways (fractions and multiples of it are, that is, like
89ddd4a425Ssam  * half of a ``long time'', almost a long time, etc.)
90ddd4a425Ssam  * It is related to human patience and other factors which don't really
91ddd4a425Ssam  * change over time.
92ddd4a425Ssam  */
93ddd4a425Ssam #define	MAXSLP 		20
94ddd4a425Ssam 
95ddd4a425Ssam /*
96ddd4a425Ssam  * A swapped in process is given a small amount of core without being bothered
97ddd4a425Ssam  * by the page replacement algorithm.  Basically this says that if you are
98ddd4a425Ssam  * swapped in you deserve some resources.  We protect the last SAFERSS
99ddd4a425Ssam  * pages against paging and will just swap you out rather than paging you.
100ddd4a425Ssam  * Note that each process has at least UPAGES+CLSIZE pages which are not
101ddd4a425Ssam  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
102ddd4a425Ssam  * number just means a swapped in process is given around 25k bytes.
103ddd4a425Ssam  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
104ddd4a425Ssam  * so we loan each swapped in process memory worth 100$, or just admit
105ddd4a425Ssam  * that we don't consider it worthwhile and swap it out to disk which costs
106ddd4a425Ssam  * $30/mb or about $0.75.
107ddd4a425Ssam  */
1080b8444b9Ssam #define	SAFERSS		32		/* nominal ``small'' resident set size
109ddd4a425Ssam 					   protected against replacement */
110ddd4a425Ssam 
111ddd4a425Ssam /*
112ddd4a425Ssam  * DISKRPM is used to estimate the number of paging i/o operations
113ddd4a425Ssam  * which one can expect from a single disk controller.
114ddd4a425Ssam  */
115ddd4a425Ssam #define	DISKRPM		60
116ddd4a425Ssam 
117ddd4a425Ssam /*
118ddd4a425Ssam  * Klustering constants.  Klustering is the gathering
119ddd4a425Ssam  * of pages together for pagein/pageout, while clustering
120ddd4a425Ssam  * is the treatment of hardware page size as though it were
121ddd4a425Ssam  * larger than it really is.
122ddd4a425Ssam  *
123ddd4a425Ssam  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
124702aa092Smckusick  * units.  Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
125702aa092Smckusick  * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) to
126702aa092Smckusick  * avoid "big push" panics.
127ddd4a425Ssam  */
128ddd4a425Ssam 
129ddd4a425Ssam #define	KLMAX	(32/CLSIZE)
130ddd4a425Ssam #define	KLSEQL	(16/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
131ddd4a425Ssam #define	KLIN	(8/CLSIZE)		/* default data/stack in klust */
132ddd4a425Ssam #define	KLTXT	(4/CLSIZE)		/* default text in klust */
133ddd4a425Ssam #define	KLOUT	(32/CLSIZE)
134ddd4a425Ssam 
135ddd4a425Ssam /*
136ddd4a425Ssam  * KLSDIST is the advance or retard of the fifo reclaim for sequential
137ddd4a425Ssam  * processes data space.
138ddd4a425Ssam  */
139ddd4a425Ssam #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
140ddd4a425Ssam 
141ddd4a425Ssam /*
142ddd4a425Ssam  * Paging thresholds (see vm_sched.c).
1430b8444b9Ssam  * Strategy of 1/19/85:
1440b8444b9Ssam  *	lotsfree is 512k bytes, but at most 1/4 of memory
145ddd4a425Ssam  *	desfree is 200k bytes, but at most 1/8 of memory
146ddd4a425Ssam  *	minfree is 64k bytes, but at most 1/2 of desfree
147ddd4a425Ssam  */
1480b8444b9Ssam #define	LOTSFREE	(512 * 1024)
149ddd4a425Ssam #define	LOTSFREEFRACT	4
150ddd4a425Ssam #define	DESFREE		(200 * 1024)
151ddd4a425Ssam #define	DESFREEFRACT	8
152ddd4a425Ssam #define	MINFREE		(64 * 1024)
153ddd4a425Ssam #define	MINFREEFRACT	2
154ddd4a425Ssam 
155ddd4a425Ssam /*
1560b8444b9Ssam  * There are two clock hands, initially separated by HANDSPREAD bytes
1570b8444b9Ssam  * (but at most all of user memory).  The amount of time to reclaim
1580b8444b9Ssam  * a page once the pageout process examines it increases with this
1590b8444b9Ssam  * distance and decreases as the scan rate rises.
1600b8444b9Ssam  */
1610b8444b9Ssam #define	HANDSPREAD	(2 * 1024 * 1024)
1620b8444b9Ssam 
1630b8444b9Ssam /*
1640b8444b9Ssam  * The number of times per second to recompute the desired paging rate
1650b8444b9Ssam  * and poke the pagedaemon.
1660b8444b9Ssam  */
1670b8444b9Ssam #define	RATETOSCHEDPAGING	4
1680b8444b9Ssam 
1690b8444b9Ssam /*
170ddd4a425Ssam  * Believed threshold (in megabytes) for which interleaved
171ddd4a425Ssam  * swapping area is desirable.
172ddd4a425Ssam  */
173ddd4a425Ssam #define	LOTSOFMEM	2
174ddd4a425Ssam 
175a1d503faSkarels #define	mapin(pte, v, pfnum, prot) \
176a1d503faSkarels 	(*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v))
1770b8444b9Ssam 
1780b8444b9Ssam /*
1790b8444b9Ssam  * Invalidate a cluster (optimized here for standard CLSIZE).
1800b8444b9Ssam  */
1810b8444b9Ssam #if CLSIZE == 1
1820b8444b9Ssam #define	tbiscl(v)	mtpr(TBIS, ptob(v))
1830b8444b9Ssam #endif
184