xref: /csrg-svn/sys/pmax/include/vmparam.h (revision 67058)
152131Smckusick /*
252131Smckusick  * Copyright (c) 1988 University of Utah.
363217Sbostic  * Copyright (c) 1992, 1993
463217Sbostic  *	The Regents of the University of California.  All rights reserved.
552131Smckusick  *
652131Smckusick  * This code is derived from software contributed to Berkeley by
752131Smckusick  * the Systems Programming Group of the University of Utah Computer
852131Smckusick  * Science Department and Ralph Campbell.
952131Smckusick  *
1052131Smckusick  * %sccs.include.redist.c%
1152131Smckusick  *
1252131Smckusick  * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
1352131Smckusick  *
14*67058Smckusick  *	@(#)vmparam.h	8.2 (Berkeley) 04/22/94
1552131Smckusick  */
1652131Smckusick 
1752131Smckusick /*
1852131Smckusick  * Machine dependent constants for DEC Station 3100.
1952131Smckusick  */
2052131Smckusick /*
2152131Smckusick  * USRTEXT is the start of the user text/data space, while USRSTACK
2252131Smckusick  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
2352131Smckusick  * the number of pages from the beginning of the P0 region to the
2452131Smckusick  * beginning of the text and from the beginning of the P1 region to the
2552131Smckusick  * beginning of the stack respectively.
2652131Smckusick  */
2759830Sralph #define	USRTEXT		0x00001000
2852131Smckusick #define	USRSTACK	0x80000000	/* Start of user stack */
2952131Smckusick #define	BTOPUSRSTACK	0x80000		/* btop(USRSTACK) */
3059830Sralph #define	LOWPAGES	0x00001
3152131Smckusick #define	HIGHPAGES	0
3252131Smckusick 
3352131Smckusick /*
3452131Smckusick  * Virtual memory related constants, all in bytes
3552131Smckusick  */
3652131Smckusick #ifndef MAXTSIZ
3752131Smckusick #define	MAXTSIZ		(24*1024*1024)		/* max text size */
3852131Smckusick #endif
3952131Smckusick #ifndef DFLDSIZ
4052131Smckusick #define	DFLDSIZ		(32*1024*1024)		/* initial data size limit */
4152131Smckusick #endif
4252131Smckusick #ifndef MAXDSIZ
4352131Smckusick #define	MAXDSIZ		(32*1024*1024)		/* max data size */
4452131Smckusick #endif
4552131Smckusick #ifndef	DFLSSIZ
4652131Smckusick #define	DFLSSIZ		(1024*1024)		/* initial stack size limit */
4752131Smckusick #endif
4852131Smckusick #ifndef	MAXSSIZ
4952131Smckusick #define	MAXSSIZ		MAXDSIZ			/* max stack size */
5052131Smckusick #endif
5152131Smckusick 
5252131Smckusick /*
5352131Smckusick  * Default sizes of swap allocation chunks (see dmap.h).
5452131Smckusick  * The actual values may be changed in vminit() based on MAXDSIZ.
5552131Smckusick  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
5652131Smckusick  * DMMIN should be at least ctod(1) so that vtod() works.
5752131Smckusick  * vminit() insures this.
5852131Smckusick  */
5952131Smckusick #define	DMMIN	32			/* smallest swap allocation */
6052131Smckusick #define	DMMAX	4096			/* largest potential swap allocation */
6152131Smckusick 
6252131Smckusick /*
6352131Smckusick  * Sizes of the system and user portions of the system page table.
6452131Smckusick  */
6552131Smckusick /* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */
6652131Smckusick #define	SYSPTSIZE	1228
6752131Smckusick #define	USRPTSIZE 	1024
6852131Smckusick 
6952131Smckusick /*
7052131Smckusick  * PTEs for mapping user space into the kernel for phyio operations.
7152131Smckusick  * 16 pte's are enough to cover 8 disks * MAXBSIZE.
7252131Smckusick  */
7352131Smckusick #ifndef USRIOSIZE
7452131Smckusick #define USRIOSIZE	32
7552131Smckusick #endif
7652131Smckusick 
7752131Smckusick /*
7852131Smckusick  * PTEs for system V style shared memory.
7952131Smckusick  * This is basically slop for kmempt which we actually allocate (malloc) from.
8052131Smckusick  */
8152131Smckusick #ifndef SHMMAXPGS
8252131Smckusick #define SHMMAXPGS	1024		/* 4mb */
8352131Smckusick #endif
8452131Smckusick 
8552131Smckusick /*
8652131Smckusick  * Boundary at which to place first MAPMEM segment if not explicitly
8752131Smckusick  * specified.  Should be a power of two.  This allows some slop for
8852131Smckusick  * the data segment to grow underneath the first mapped segment.
8952131Smckusick  */
9052131Smckusick #define MMSEG		0x200000
9152131Smckusick 
9252131Smckusick /*
9352131Smckusick  * The size of the clock loop.
9452131Smckusick  */
9552131Smckusick #define	LOOPPAGES	(maxfree - firstfree)
9652131Smckusick 
9752131Smckusick /*
9852131Smckusick  * The time for a process to be blocked before being very swappable.
9952131Smckusick  * This is a number of seconds which the system takes as being a non-trivial
10052131Smckusick  * amount of real time.  You probably shouldn't change this;
10152131Smckusick  * it is used in subtle ways (fractions and multiples of it are, that is, like
10252131Smckusick  * half of a ``long time'', almost a long time, etc.)
10352131Smckusick  * It is related to human patience and other factors which don't really
10452131Smckusick  * change over time.
10552131Smckusick  */
10652131Smckusick #define	MAXSLP 		20
10752131Smckusick 
10852131Smckusick /*
10952131Smckusick  * A swapped in process is given a small amount of core without being bothered
11052131Smckusick  * by the page replacement algorithm.  Basically this says that if you are
11152131Smckusick  * swapped in you deserve some resources.  We protect the last SAFERSS
11252131Smckusick  * pages against paging and will just swap you out rather than paging you.
11352131Smckusick  * Note that each process has at least UPAGES+CLSIZE pages which are not
11452131Smckusick  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
11552131Smckusick  * number just means a swapped in process is given around 25k bytes.
11652131Smckusick  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
11752131Smckusick  * so we loan each swapped in process memory worth 100$, or just admit
11852131Smckusick  * that we don't consider it worthwhile and swap it out to disk which costs
11952131Smckusick  * $30/mb or about $0.75.
12052131Smckusick  */
12152131Smckusick #define	SAFERSS		4		/* nominal ``small'' resident set size
12252131Smckusick 					   protected against replacement */
12352131Smckusick 
12452131Smckusick /*
12552131Smckusick  * DISKRPM is used to estimate the number of paging i/o operations
12652131Smckusick  * which one can expect from a single disk controller.
12752131Smckusick  */
12852131Smckusick #define	DISKRPM		60
12952131Smckusick 
13052131Smckusick /*
13152131Smckusick  * Klustering constants.  Klustering is the gathering
13252131Smckusick  * of pages together for pagein/pageout, while clustering
13352131Smckusick  * is the treatment of hardware page size as though it were
13452131Smckusick  * larger than it really is.
13552131Smckusick  *
13652131Smckusick  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
13752131Smckusick  * units.  Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
13852131Smckusick  * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
13952131Smckusick  * unless you like "big push" panics.
14052131Smckusick  */
14152131Smckusick 
14252131Smckusick #ifdef notdef /* XXX */
14352131Smckusick #define	KLMAX	(4/CLSIZE)
14452131Smckusick #define	KLSEQL	(2/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
14552131Smckusick #define	KLIN	(4/CLSIZE)		/* default data/stack in klust */
14652131Smckusick #define	KLTXT	(4/CLSIZE)		/* default text in klust */
14752131Smckusick #define	KLOUT	(4/CLSIZE)
14852131Smckusick #else
14952131Smckusick #define	KLMAX	(1/CLSIZE)
15052131Smckusick #define	KLSEQL	(1/CLSIZE)
15152131Smckusick #define	KLIN	(1/CLSIZE)
15252131Smckusick #define	KLTXT	(1/CLSIZE)
15352131Smckusick #define	KLOUT	(1/CLSIZE)
15452131Smckusick #endif
15552131Smckusick 
15652131Smckusick /*
15752131Smckusick  * KLSDIST is the advance or retard of the fifo reclaim for sequential
15852131Smckusick  * processes data space.
15952131Smckusick  */
16052131Smckusick #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
16152131Smckusick 
16252131Smckusick /*
16352131Smckusick  * Paging thresholds (see vm_sched.c).
16452131Smckusick  * Strategy of 1/19/85:
16552131Smckusick  *	lotsfree is 512k bytes, but at most 1/4 of memory
16652131Smckusick  *	desfree is 200k bytes, but at most 1/8 of memory
16752131Smckusick  */
16852131Smckusick #define	LOTSFREE	(512 * 1024)
16952131Smckusick #define	LOTSFREEFRACT	4
17052131Smckusick #define	DESFREE		(200 * 1024)
17152131Smckusick #define	DESFREEFRACT	8
17252131Smckusick 
17352131Smckusick /*
17452131Smckusick  * There are two clock hands, initially separated by HANDSPREAD bytes
17552131Smckusick  * (but at most all of user memory).  The amount of time to reclaim
17652131Smckusick  * a page once the pageout process examines it increases with this
17752131Smckusick  * distance and decreases as the scan rate rises.
17852131Smckusick  */
17952131Smckusick #define	HANDSPREAD	(2 * 1024 * 1024)
18052131Smckusick 
18152131Smckusick /*
18252131Smckusick  * The number of times per second to recompute the desired paging rate
18352131Smckusick  * and poke the pagedaemon.
18452131Smckusick  */
18552131Smckusick #define	RATETOSCHEDPAGING	4
18652131Smckusick 
18752131Smckusick /*
18852131Smckusick  * Believed threshold (in megabytes) for which interleaved
18952131Smckusick  * swapping area is desirable.
19052131Smckusick  */
19152131Smckusick #define	LOTSOFMEM	2
19252131Smckusick 
19352131Smckusick #define	mapin(pte, v, pfnum, prot) \
19452131Smckusick 	(*(int *)(pte) = ((pfnum) << PG_SHIFT) | (prot), MachTLBFlushAddr(v))
19552131Smckusick 
19652131Smckusick /*
19752131Smckusick  * Mach derived constants
19852131Smckusick  */
19952131Smckusick 
20052131Smckusick /* user/kernel map constants */
20157871Sralph #define VM_MIN_ADDRESS		((vm_offset_t)0x1000)
20252131Smckusick #define VM_MAXUSER_ADDRESS	((vm_offset_t)0x80000000)
20352131Smckusick #define VM_MAX_ADDRESS		((vm_offset_t)0x80000000)
20452131Smckusick #define VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0xC0000000)
20552131Smckusick #define VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFC000)
20652131Smckusick 
20752131Smckusick /* virtual sizes (bytes) for various kernel submaps */
20852131Smckusick #define VM_MBUF_SIZE		(NMBCLUSTERS*MCLBYTES)
20952131Smckusick #define VM_KMEM_SIZE		(NKMEMCLUSTERS*CLBYTES)
21052131Smckusick #define VM_PHYS_SIZE		(USRIOSIZE*CLBYTES)
21152131Smckusick 
21252131Smckusick /* pcb base */
21352131Smckusick #define	pcbb(p)		((u_int)(p)->p_addr)
214