xref: /csrg-svn/sys/tahoe/include/vmparam.h (revision 33285)
1*33285Skarels /*	vmparam.h	1.8	88/01/07	*/
224010Ssam 
324010Ssam /*
425926Ssam  * Machine dependent constants for tahoe.
524010Ssam  */
625926Ssam 
724010Ssam /*
824010Ssam  * USRTEXT is the start of the user text/data space, while USRSTACK
924010Ssam  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
1024010Ssam  * the number of pages from the beginning of the P0 region to the
1124010Ssam  * beginning of the text and from the beginning of the P2 region to the
1224010Ssam  * beginning of the stack respectively.
1324010Ssam  */
1424010Ssam #define	USRTEXT		0
1525678Ssam #define	USRSTACK	(0xc0000000-UPAGES*NBPG) /* Start of user stack */
1625678Ssam #define	BTOPUSRSTACK	(0x300000 - UPAGES)	 /* btop(USRSTACK) */
1724010Ssam #define	P2PAGES		0x100000	/* number of pages in P2 region */
1824010Ssam #define	LOWPAGES	0
1924010Ssam #define	HIGHPAGES	UPAGES
2024010Ssam 
2124010Ssam /*
2225854Ssam  * Virtual memory related constants, all in bytes
2324010Ssam  */
2425854Ssam #define	MAXTSIZ		(6*1024*1024)		/* max text size */
2525678Ssam #ifndef DFLDSIZ
2625854Ssam #define	DFLDSIZ		(6*1024*1024)		/* initial data size limit */
2725678Ssam #endif
2825678Ssam #ifndef MAXDSIZ
2927184Ssam #define	MAXDSIZ		(32*1024*1024)		/* max data size */
3025678Ssam #endif
3125678Ssam #ifndef	DFLSSIZ
3225854Ssam #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
3325678Ssam #endif
3425678Ssam #ifndef	MAXSSIZ
3525678Ssam #define	MAXSSIZ		MAXDSIZ			/* max stack size */
3625678Ssam #endif
3724010Ssam 
3824010Ssam /*
3925678Ssam  * Default sizes of swap allocation chunks (see dmap.h).
4025678Ssam  * The actual values may be changed in vminit() based on MAXDSIZ.
4125678Ssam  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
4225678Ssam  */
4325678Ssam #define	DMMIN	32			/* smallest swap allocation */
4425678Ssam #define	DMMAX	4096			/* largest potential swap allocation */
4525678Ssam #define	DMTEXT	1024			/* swap allocation for text */
4625678Ssam 
4725678Ssam /*
4824010Ssam  * Sizes of the system and user portions of the system page table.
4924010Ssam  */
5024010Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
5131317Skarels #define	SYSPTSIZE	((20+MAXUSERS/2)*NPTEPG)
5225678Ssam #define	USRPTSIZE 	(4*NPTEPG)
5324010Ssam 
5424010Ssam /*
5524010Ssam  * The size of the clock loop.
5624010Ssam  */
5724010Ssam #define	LOOPPAGES	(maxfree - firstfree)
5824010Ssam 
5924010Ssam /*
6024010Ssam  * The time for a process to be blocked before being very swappable.
6124010Ssam  * This is a number of seconds which the system takes as being a non-trivial
6224010Ssam  * amount of real time.  You probably shouldn't change this;
6324010Ssam  * it is used in subtle ways (fractions and multiples of it are, that is, like
6424010Ssam  * half of a ``long time'', almost a long time, etc.)
6524010Ssam  * It is related to human patience and other factors which don't really
6624010Ssam  * change over time.
6724010Ssam  */
6824010Ssam #define	MAXSLP 		20
6924010Ssam 
7024010Ssam /*
7124010Ssam  * A swapped in process is given a small amount of core without being bothered
7224010Ssam  * by the page replacement algorithm.  Basically this says that if you are
7324010Ssam  * swapped in you deserve some resources.  We protect the last SAFERSS
7424010Ssam  * pages against paging and will just swap you out rather than paging you.
7524010Ssam  * Note that each process has at least UPAGES+CLSIZE pages which are not
7624010Ssam  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
7724010Ssam  * number just means a swapped in process is given around 25k bytes.
7824010Ssam  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
7924010Ssam  * so we loan each swapped in process memory worth 100$, or just admit
8024010Ssam  * that we don't consider it worthwhile and swap it out to disk which costs
8124010Ssam  * $30/mb or about $0.75.
8224010Ssam  */
8325678Ssam #define	SAFERSS		32		/* nominal ``small'' resident set size
8424010Ssam 					   protected against replacement */
8524010Ssam 
8624010Ssam /*
8724010Ssam  * DISKRPM is used to estimate the number of paging i/o operations
8824010Ssam  * which one can expect from a single disk controller.
8924010Ssam  */
9024010Ssam #define	DISKRPM		60
9124010Ssam 
9224010Ssam /*
9324010Ssam  * Klustering constants.  Klustering is the gathering
9424010Ssam  * of pages together for pagein/pageout, while clustering
9524010Ssam  * is the treatment of hardware page size as though it were
9624010Ssam  * larger than it really is.
9724010Ssam  *
9824010Ssam  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
9924010Ssam  * units.  Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h.
10024010Ssam  */
10124010Ssam 
10224010Ssam #define	KLMAX	(32/CLSIZE)
10324010Ssam #define	KLSEQL	(16/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
10424010Ssam #define	KLIN	(8/CLSIZE)		/* default data/stack in klust */
10524010Ssam #define	KLTXT	(4/CLSIZE)		/* default text in klust */
10624010Ssam #define	KLOUT	(32/CLSIZE)
10724010Ssam 
10824010Ssam /*
10924010Ssam  * KLSDIST is the advance or retard of the fifo reclaim for sequential
11024010Ssam  * processes data space.
11124010Ssam  */
11224010Ssam #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
11324010Ssam 
11424010Ssam /*
11524010Ssam  * Paging thresholds (see vm_sched.c).
11625678Ssam  * Strategy of 1/19/85:
11725678Ssam  *	lotsfree is 512k bytes, but at most 1/4 of memory
11824010Ssam  *	desfree is 200k bytes, but at most 1/8 of memory
11924010Ssam  *	minfree is 64k bytes, but at most 1/2 of desfree
12024010Ssam  */
12125678Ssam #define	LOTSFREE	(512 * 1024)
12224010Ssam #define	LOTSFREEFRACT	4
12324010Ssam #define	DESFREE		(200 * 1024)
12424010Ssam #define	DESFREEFRACT	8
12524010Ssam #define	MINFREE		(64 * 1024)
12624010Ssam #define	MINFREEFRACT	2
12724010Ssam 
12824010Ssam /*
12925678Ssam  * There are two clock hands, initially separated by HANDSPREAD bytes
13025678Ssam  * (but at most all of user memory).  The amount of time to reclaim
13125678Ssam  * a page once the pageout process examines it increases with this
13225678Ssam  * distance and decreases as the scan rate rises.
13325678Ssam  */
13425678Ssam #define	HANDSPREAD	(2 * 1024 * 1024)
13525678Ssam 
13625678Ssam /*
13725678Ssam  * The number of times per second to recompute the desired paging rate
13825678Ssam  * and poke the pagedaemon.
13925678Ssam  */
14025678Ssam #define	RATETOSCHEDPAGING	4
14125678Ssam 
14225678Ssam /*
14324010Ssam  * Believed threshold (in megabytes) for which interleaved
14424010Ssam  * swapping area is desirable.
14524010Ssam  */
14624010Ssam #define	LOTSOFMEM	2
14724010Ssam 
148*33285Skarels #define	mapin(pte, v, pfnum, prot) \
149*33285Skarels 	(*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v))
15024010Ssam 
15125678Ssam /*
15225678Ssam  * Invalidate a cluster (optimized here for standard CLSIZE).
15325678Ssam  */
15425678Ssam #if CLSIZE == 1
15525678Ssam #define	tbiscl(v)	mtpr(TBIS, ptob(v))
15625678Ssam #endif
157