xref: /csrg-svn/sys/tahoe/include/vmparam.h (revision 25678)
1*25678Ssam /*	vmparam.h	1.2	86/01/05	*/
224010Ssam 
324010Ssam /*
424010Ssam  * Machine dependent constants for TAHOE
524010Ssam  */
624010Ssam /*
724010Ssam  * USRTEXT is the start of the user text/data space, while USRSTACK
824010Ssam  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
924010Ssam  * the number of pages from the beginning of the P0 region to the
1024010Ssam  * beginning of the text and from the beginning of the P2 region to the
1124010Ssam  * beginning of the stack respectively.
1224010Ssam  */
1324010Ssam #define	USRTEXT		0
14*25678Ssam #define	USRSTACK	(0xc0000000-UPAGES*NBPG) /* Start of user stack */
15*25678Ssam #define	BTOPUSRSTACK	(0x300000 - UPAGES)	 /* btop(USRSTACK) */
1624010Ssam #define	P2PAGES		0x100000	/* number of pages in P2 region */
1724010Ssam #define	LOWPAGES	0
1824010Ssam #define	HIGHPAGES	UPAGES
1924010Ssam 
2024010Ssam /*
21*25678Ssam  * Virtual memory related constants, all in clicks
2224010Ssam  */
23*25678Ssam #define	MAXTSIZ		(6*CLSIZE*1024)		/* max text size */
24*25678Ssam #ifndef DFLDSIZ
25*25678Ssam #define	DFLDSIZ		(6*1024*1024/NBPG)	/* initial data size limit */
26*25678Ssam #endif
27*25678Ssam #ifndef MAXDSIZ
28*25678Ssam #define	MAXDSIZ		(19*1024*1024/NBPG)	/* max data size */
29*25678Ssam #endif
30*25678Ssam #ifndef	DFLSSIZ
31*25678Ssam #define	DFLSSIZ		(512*1024/NBPG)		/* initial stack size limit */
32*25678Ssam #endif
33*25678Ssam #ifndef	MAXSSIZ
34*25678Ssam #define	MAXSSIZ		MAXDSIZ			/* max stack size */
35*25678Ssam #endif
3624010Ssam 
3724010Ssam /*
38*25678Ssam  * Default sizes of swap allocation chunks (see dmap.h).
39*25678Ssam  * The actual values may be changed in vminit() based on MAXDSIZ.
40*25678Ssam  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
41*25678Ssam  */
42*25678Ssam #define	DMMIN	32			/* smallest swap allocation */
43*25678Ssam #define	DMMAX	4096			/* largest potential swap allocation */
44*25678Ssam #define	DMTEXT	1024			/* swap allocation for text */
45*25678Ssam 
46*25678Ssam /*
4724010Ssam  * Sizes of the system and user portions of the system page table.
4824010Ssam  */
4924010Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
50*25678Ssam #ifdef notdef
51*25678Ssam #define	SYSPTSIZE	((20+MAXUSERS)*NPTEPG)
52*25678Ssam #define	USRPTSIZE 	(32*NPTEPG)
53*25678Ssam #else
54*25678Ssam #define	SYSPTSIZE	((128*NPTEPG/2)+(MAXUSERS*NPTEPG/16))
55*25678Ssam #define	USRPTSIZE 	(4*NPTEPG)
56*25678Ssam #endif
5724010Ssam 
5824010Ssam /*
5924010Ssam  * The size of the clock loop.
6024010Ssam  */
6124010Ssam #define	LOOPPAGES	(maxfree - firstfree)
6224010Ssam 
6324010Ssam /*
6424010Ssam  * The time for a process to be blocked before being very swappable.
6524010Ssam  * This is a number of seconds which the system takes as being a non-trivial
6624010Ssam  * amount of real time.  You probably shouldn't change this;
6724010Ssam  * it is used in subtle ways (fractions and multiples of it are, that is, like
6824010Ssam  * half of a ``long time'', almost a long time, etc.)
6924010Ssam  * It is related to human patience and other factors which don't really
7024010Ssam  * change over time.
7124010Ssam  */
7224010Ssam #define	MAXSLP 		20
7324010Ssam 
7424010Ssam /*
7524010Ssam  * A swapped in process is given a small amount of core without being bothered
7624010Ssam  * by the page replacement algorithm.  Basically this says that if you are
7724010Ssam  * swapped in you deserve some resources.  We protect the last SAFERSS
7824010Ssam  * pages against paging and will just swap you out rather than paging you.
7924010Ssam  * Note that each process has at least UPAGES+CLSIZE pages which are not
8024010Ssam  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
8124010Ssam  * number just means a swapped in process is given around 25k bytes.
8224010Ssam  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
8324010Ssam  * so we loan each swapped in process memory worth 100$, or just admit
8424010Ssam  * that we don't consider it worthwhile and swap it out to disk which costs
8524010Ssam  * $30/mb or about $0.75.
8624010Ssam  */
87*25678Ssam #define	SAFERSS		32		/* nominal ``small'' resident set size
8824010Ssam 					   protected against replacement */
8924010Ssam 
9024010Ssam /*
9124010Ssam  * DISKRPM is used to estimate the number of paging i/o operations
9224010Ssam  * which one can expect from a single disk controller.
9324010Ssam  */
9424010Ssam #define	DISKRPM		60
9524010Ssam 
9624010Ssam /*
9724010Ssam  * Klustering constants.  Klustering is the gathering
9824010Ssam  * of pages together for pagein/pageout, while clustering
9924010Ssam  * is the treatment of hardware page size as though it were
10024010Ssam  * larger than it really is.
10124010Ssam  *
10224010Ssam  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
10324010Ssam  * units.  Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
10424010Ssam  */
10524010Ssam 
10624010Ssam #define	KLMAX	(32/CLSIZE)
10724010Ssam #define	KLSEQL	(16/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
10824010Ssam #define	KLIN	(8/CLSIZE)		/* default data/stack in klust */
10924010Ssam #define	KLTXT	(4/CLSIZE)		/* default text in klust */
11024010Ssam #define	KLOUT	(32/CLSIZE)
11124010Ssam 
11224010Ssam /*
11324010Ssam  * KLSDIST is the advance or retard of the fifo reclaim for sequential
11424010Ssam  * processes data space.
11524010Ssam  */
11624010Ssam #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
11724010Ssam 
11824010Ssam /*
11924010Ssam  * Paging thresholds (see vm_sched.c).
120*25678Ssam  * Strategy of 1/19/85:
121*25678Ssam  *	lotsfree is 512k bytes, but at most 1/4 of memory
12224010Ssam  *	desfree is 200k bytes, but at most 1/8 of memory
12324010Ssam  *	minfree is 64k bytes, but at most 1/2 of desfree
12424010Ssam  */
125*25678Ssam #define	LOTSFREE	(512 * 1024)
12624010Ssam #define	LOTSFREEFRACT	4
12724010Ssam #define	DESFREE		(200 * 1024)
12824010Ssam #define	DESFREEFRACT	8
12924010Ssam #define	MINFREE		(64 * 1024)
13024010Ssam #define	MINFREEFRACT	2
13124010Ssam 
13224010Ssam /*
133*25678Ssam  * There are two clock hands, initially separated by HANDSPREAD bytes
134*25678Ssam  * (but at most all of user memory).  The amount of time to reclaim
135*25678Ssam  * a page once the pageout process examines it increases with this
136*25678Ssam  * distance and decreases as the scan rate rises.
137*25678Ssam  */
138*25678Ssam #define	HANDSPREAD	(2 * 1024 * 1024)
139*25678Ssam 
140*25678Ssam /*
141*25678Ssam  * The number of times per second to recompute the desired paging rate
142*25678Ssam  * and poke the pagedaemon.
143*25678Ssam  */
144*25678Ssam #define	RATETOSCHEDPAGING	4
145*25678Ssam 
146*25678Ssam /*
14724010Ssam  * Believed threshold (in megabytes) for which interleaved
14824010Ssam  * swapping area is desirable.
14924010Ssam  */
15024010Ssam #define	LOTSOFMEM	2
15124010Ssam 
15224010Ssam /*
15324010Ssam  * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1
15424010Ssam  */
15524010Ssam #define	mapin(pte, v, pfnum, count, prot) \
156*25678Ssam 	(*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v)))
15724010Ssam 
158*25678Ssam /*
159*25678Ssam  * Invalidate a cluster (optimized here for standard CLSIZE).
160*25678Ssam  */
161*25678Ssam #if CLSIZE == 1
162*25678Ssam #define	tbiscl(v)	mtpr(TBIS, ptob(v))
163*25678Ssam #endif
164*25678Ssam 
16524010Ssam /*
16624010Ssam  * The following constant is used to initialize the map of the
16724010Ssam  * system page table i/o entries.
16824010Ssam  * It's value should be the highest i/o address used by all the
16924010Ssam  * controllers handled in the system as specified in ubminit
17024010Ssam  * structure in ioconf.c.
171*25678Ssam  */
172*25678Ssam #define MAXIOADDR	0xffffee45
173*25678Ssam /* number of entries in the system page pable for i/o space */
174*25678Ssam #define IOSIZE		(((MAXIOADDR - (int)IOBASE+ NBPG-1) >> PGSHIFT)+1)
175*25678Ssam #define TBUFSIZ		32		/* maximum tape buffer size */
176*25678Ssam #define	ACEBPTE		32		/* ACC Ethernet (ACE) I/O window */
177