xref: /csrg-svn/sys/hp300/include/vmparam.h (revision 45755)
141474Smckusick /*
241474Smckusick  * Copyright (c) 1988 University of Utah.
341474Smckusick  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
441474Smckusick  * All rights reserved.
541474Smckusick  *
641474Smckusick  * This code is derived from software contributed to Berkeley by
741474Smckusick  * the Systems Programming Group of the University of Utah Computer
841474Smckusick  * Science Department.
941474Smckusick  *
1041474Smckusick  * %sccs.include.redist.c%
1141474Smckusick  *
1241474Smckusick  * from: Utah $Hdr: vmparam.h 1.14 89/08/14$
1341474Smckusick  *
14*45755Smckusick  *	@(#)vmparam.h	7.2 (Berkeley) 12/05/90
1541474Smckusick  */
1641474Smckusick 
1741474Smckusick /*
1841474Smckusick  * Machine dependent constants for HP300
1941474Smckusick  */
2041474Smckusick /*
2141474Smckusick  * USRTEXT is the start of the user text/data space, while USRSTACK
2241474Smckusick  * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
2341474Smckusick  * the number of pages from the beginning of the P0 region to the
2441474Smckusick  * beginning of the text and from the beginning of the P1 region to the
2541474Smckusick  * beginning of the stack respectively.
2641474Smckusick  *
2741474Smckusick  * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
2841474Smckusick  * is for HPUX compatibility.  Why??  Because HPUX's debuggers
2941474Smckusick  * have the user's stack hard-wired at FFF00000 for post-mortems,
3041474Smckusick  * and we must be compatible...
3141474Smckusick  */
3241474Smckusick #define	USRTEXT		0
3341474Smckusick #define	USRSTACK	(-HIGHPAGES*NBPG)	/* Start of user stack */
3441474Smckusick #define	BTOPUSRSTACK	(0x100000-HIGHPAGES)	/* btop(USRSTACK) */
3541474Smckusick #define P1PAGES		0x100000
3641474Smckusick #define	LOWPAGES	0
3741474Smckusick #define HIGHPAGES	(0x100000/NBPG)
3841474Smckusick 
3941474Smckusick /*
4041474Smckusick  * Virtual memory related constants, all in bytes
4141474Smckusick  */
4241474Smckusick #ifndef MAXTSIZ
4341474Smckusick #define	MAXTSIZ		(6*1024*1024)		/* max text size */
4441474Smckusick #endif
4541474Smckusick #ifndef DFLDSIZ
4641474Smckusick #define	DFLDSIZ		(8*1024*1024)		/* initial data size limit */
4741474Smckusick #endif
4841474Smckusick #ifndef MAXDSIZ
4941474Smckusick #define	MAXDSIZ		(16*1024*1024)		/* max data size */
5041474Smckusick #endif
5141474Smckusick #ifndef	DFLSSIZ
5241474Smckusick #define	DFLSSIZ		(512*1024)		/* initial stack size limit */
5341474Smckusick #endif
5441474Smckusick #ifndef	MAXSSIZ
5541474Smckusick #define	MAXSSIZ		MAXDSIZ			/* max stack size */
5641474Smckusick #endif
5741474Smckusick 
5841474Smckusick /*
5941474Smckusick  * Default sizes of swap allocation chunks (see dmap.h).
6041474Smckusick  * The actual values may be changed in vminit() based on MAXDSIZ.
6141474Smckusick  * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024.
6241474Smckusick  * DMMIN should be at least ctod(1) so that vtod() works.
6341474Smckusick  * vminit() insures this.
6441474Smckusick  */
6541474Smckusick #define	DMMIN	32			/* smallest swap allocation */
6641474Smckusick #define	DMMAX	4096			/* largest potential swap allocation */
6741474Smckusick #define	DMTEXT	1024			/* swap allocation for text */
6841474Smckusick 
6941474Smckusick /*
7041474Smckusick  * Sizes of the system and user portions of the system page table.
7141474Smckusick  */
7241474Smckusick /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
7341474Smckusick #define	SYSPTSIZE	(2 * NPTEPG)
7441474Smckusick #define	USRPTSIZE 	(1 * NPTEPG)
7541474Smckusick 
7641474Smckusick /*
7741474Smckusick  * PTEs for mapping user space into kernel for phyio operations.
7841474Smckusick  * One page is enough to handle 4Mb of simultaneous raw IO operations.
7941474Smckusick  */
8041474Smckusick #define USRIOSIZE	(1 * NPTEPG)
8141474Smckusick 
8241474Smckusick /*
8341474Smckusick  * PTEs for system V style shared memory.
8441474Smckusick  * This is basically slop for kmempt which we actually allocate (malloc) from.
8541474Smckusick  */
8641474Smckusick #define SHMMAXPGS	1024
8741474Smckusick 
8841474Smckusick /*
8941474Smckusick  * Boundary at which to place first MAPMEM segment if not explicitly
9041474Smckusick  * specified.  Should be a power of two.  This allows some slop for
9141474Smckusick  * the data segment to grow underneath the first mapped segment.
9241474Smckusick  */
9341474Smckusick #define MMSEG		0x200000
9441474Smckusick 
9541474Smckusick /*
9641474Smckusick  * The size of the clock loop.
9741474Smckusick  */
9841474Smckusick #define	LOOPPAGES	(maxfree - firstfree)
9941474Smckusick 
10041474Smckusick /*
10141474Smckusick  * The time for a process to be blocked before being very swappable.
10241474Smckusick  * This is a number of seconds which the system takes as being a non-trivial
10341474Smckusick  * amount of real time.  You probably shouldn't change this;
10441474Smckusick  * it is used in subtle ways (fractions and multiples of it are, that is, like
10541474Smckusick  * half of a ``long time'', almost a long time, etc.)
10641474Smckusick  * It is related to human patience and other factors which don't really
10741474Smckusick  * change over time.
10841474Smckusick  */
10941474Smckusick #define	MAXSLP 		20
11041474Smckusick 
11141474Smckusick /*
11241474Smckusick  * A swapped in process is given a small amount of core without being bothered
11341474Smckusick  * by the page replacement algorithm.  Basically this says that if you are
11441474Smckusick  * swapped in you deserve some resources.  We protect the last SAFERSS
11541474Smckusick  * pages against paging and will just swap you out rather than paging you.
11641474Smckusick  * Note that each process has at least UPAGES+CLSIZE pages which are not
11741474Smckusick  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
11841474Smckusick  * number just means a swapped in process is given around 25k bytes.
11941474Smckusick  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
12041474Smckusick  * so we loan each swapped in process memory worth 100$, or just admit
12141474Smckusick  * that we don't consider it worthwhile and swap it out to disk which costs
12241474Smckusick  * $30/mb or about $0.75.
12341474Smckusick  */
12441474Smckusick #define	SAFERSS		4		/* nominal ``small'' resident set size
12541474Smckusick 					   protected against replacement */
12641474Smckusick 
12741474Smckusick /*
12841474Smckusick  * DISKRPM is used to estimate the number of paging i/o operations
12941474Smckusick  * which one can expect from a single disk controller.
13041474Smckusick  */
13141474Smckusick #define	DISKRPM		60
13241474Smckusick 
13341474Smckusick /*
13441474Smckusick  * Klustering constants.  Klustering is the gathering
13541474Smckusick  * of pages together for pagein/pageout, while clustering
13641474Smckusick  * is the treatment of hardware page size as though it were
13741474Smckusick  * larger than it really is.
13841474Smckusick  *
13941474Smckusick  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
14041474Smckusick  * units.  Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
14141474Smckusick  * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
14241474Smckusick  * unless you like "big push" panics.
14341474Smckusick  */
14441474Smckusick 
14541474Smckusick #define	KLMAX	(4/CLSIZE)
14641474Smckusick #define	KLSEQL	(2/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
14741474Smckusick #define	KLIN	(4/CLSIZE)		/* default data/stack in klust */
14841474Smckusick #define	KLTXT	(4/CLSIZE)		/* default text in klust */
14941474Smckusick #define	KLOUT	(4/CLSIZE)
15041474Smckusick 
15141474Smckusick /*
15241474Smckusick  * KLSDIST is the advance or retard of the fifo reclaim for sequential
15341474Smckusick  * processes data space.
15441474Smckusick  */
15541474Smckusick #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
15641474Smckusick 
15741474Smckusick /*
15841474Smckusick  * Paging thresholds (see vm_sched.c).
15941474Smckusick  * Strategy of 1/19/85:
16041474Smckusick  *	lotsfree is 512k bytes, but at most 1/4 of memory
16141474Smckusick  *	desfree is 200k bytes, but at most 1/8 of memory
16241474Smckusick  *	minfree is 64k bytes, but at most 1/2 of desfree
16341474Smckusick  */
16441474Smckusick #define	LOTSFREE	(512 * 1024)
16541474Smckusick #define	LOTSFREEFRACT	4
16641474Smckusick #define	DESFREE		(200 * 1024)
16741474Smckusick #define	DESFREEFRACT	8
16841474Smckusick #define	MINFREE		(64 * 1024)
16941474Smckusick #define	MINFREEFRACT	2
17041474Smckusick 
17141474Smckusick /*
17241474Smckusick  * There are two clock hands, initially separated by HANDSPREAD bytes
17341474Smckusick  * (but at most all of user memory).  The amount of time to reclaim
17441474Smckusick  * a page once the pageout process examines it increases with this
17541474Smckusick  * distance and decreases as the scan rate rises.
17641474Smckusick  */
17741474Smckusick #define	HANDSPREAD	(2 * 1024 * 1024)
17841474Smckusick 
17941474Smckusick /*
18041474Smckusick  * The number of times per second to recompute the desired paging rate
18141474Smckusick  * and poke the pagedaemon.
18241474Smckusick  */
18341474Smckusick #define	RATETOSCHEDPAGING	4
18441474Smckusick 
18541474Smckusick /*
18641474Smckusick  * Believed threshold (in megabytes) for which interleaved
18741474Smckusick  * swapping area is desirable.
18841474Smckusick  */
18941474Smckusick #define	LOTSOFMEM	2
19041474Smckusick 
19141474Smckusick #define	mapin(pte, v, pfnum, prot) \
19241474Smckusick 	(*(u_int *)(pte) = ((pfnum) << PGSHIFT) | (prot), TBIS((caddr_t)(v)))
193*45755Smckusick 
194*45755Smckusick /*
195*45755Smckusick  * Mach derived constants
196*45755Smckusick  */
197*45755Smckusick 
198*45755Smckusick /* user/kernel map constants */
199*45755Smckusick #define VM_MIN_ADDRESS		((vm_offset_t)0)
200*45755Smckusick #define VM_MAX_ADDRESS		((vm_offset_t)0xFFF00000)
201*45755Smckusick #define VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0)
202*45755Smckusick #define VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFF000)
203*45755Smckusick 
204*45755Smckusick /* virtual sizes (bytes) for various kernel submaps */
205*45755Smckusick #define VM_MBUF_SIZE		(NMBCLUSTERS*MCLBYTES)
206*45755Smckusick #define VM_KMEM_SIZE		(NKMEMCLUSTERS*CLBYTES)
207*45755Smckusick #define VM_PHYS_SIZE		(USRIOSIZE*CLBYTES)
208*45755Smckusick 
209*45755Smckusick /* # of kernel PT pages (initial only, can grow dynamically) */
210*45755Smckusick #define VM_KERNEL_PT_PAGES	((vm_size_t)2)		/* XXX: SYSPTSIZE */
211*45755Smckusick 
212*45755Smckusick /* pcb base */
213*45755Smckusick #define	pcbb(p)		((u_int)(p)->p_addr)
214