xref: /csrg-svn/sys/hp300/include/vmparam.h (revision 67006)
141474Smckusick /*
241474Smckusick  * Copyright (c) 1988 University of Utah.
363160Sbostic  * Copyright (c) 1982, 1986, 1990, 1993
463160Sbostic  *	The Regents of the University of California.  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  *
1249330Shibler  * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
1341474Smckusick  *
14*67006Smkm  *	@(#)vmparam.h	8.2 (Berkeley) 04/19/94
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
4359438Smckusick #define	MAXTSIZ		(8*1024*1024)		/* max text size */
4441474Smckusick #endif
4541474Smckusick #ifndef DFLDSIZ
4659438Smckusick #define	DFLDSIZ		(16*1024*1024)		/* initial data size limit */
4741474Smckusick #endif
4841474Smckusick #ifndef MAXDSIZ
4959438Smckusick #define	MAXDSIZ		(64*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 
6841474Smckusick /*
6941474Smckusick  * Sizes of the system and user portions of the system page table.
7041474Smckusick  */
7141474Smckusick /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
7249330Shibler #define	SYSPTSIZE	(2 * NPTEPG)	/* 8mb */
7349330Shibler #define	USRPTSIZE 	(1 * NPTEPG)	/* 4mb */
7441474Smckusick 
7541474Smckusick /*
7649330Shibler  * PTEs for mapping user space into the kernel for phyio operations.
7741474Smckusick  * One page is enough to handle 4Mb of simultaneous raw IO operations.
7841474Smckusick  */
7949330Shibler #ifndef USRIOSIZE
8049330Shibler #define USRIOSIZE	(1 * NPTEPG)	/* 4mb */
8149330Shibler #endif
8241474Smckusick 
8341474Smckusick /*
8441474Smckusick  * PTEs for system V style shared memory.
8541474Smckusick  * This is basically slop for kmempt which we actually allocate (malloc) from.
8641474Smckusick  */
8749330Shibler #ifndef SHMMAXPGS
8849330Shibler #define SHMMAXPGS	1024		/* 4mb */
8949330Shibler #endif
9041474Smckusick 
9141474Smckusick /*
9249330Shibler  * External IO space map size.
9349330Shibler  * By default we make it large enough to map up to 3 DIO-II devices and
9449330Shibler  * the complete DIO space.  For a 320-only configuration (which has no
9549330Shibler  * DIO-II) you could define a considerably smaller region.
9649330Shibler  */
9749330Shibler #ifndef EIOMAPSIZE
9849330Shibler #define EIOMAPSIZE	3584		/* 14mb */
9949330Shibler #endif
10049330Shibler 
10149330Shibler /*
10241474Smckusick  * Boundary at which to place first MAPMEM segment if not explicitly
10341474Smckusick  * specified.  Should be a power of two.  This allows some slop for
10441474Smckusick  * the data segment to grow underneath the first mapped segment.
10541474Smckusick  */
10641474Smckusick #define MMSEG		0x200000
10741474Smckusick 
10841474Smckusick /*
10941474Smckusick  * The size of the clock loop.
11041474Smckusick  */
11141474Smckusick #define	LOOPPAGES	(maxfree - firstfree)
11241474Smckusick 
11341474Smckusick /*
11441474Smckusick  * The time for a process to be blocked before being very swappable.
11541474Smckusick  * This is a number of seconds which the system takes as being a non-trivial
11641474Smckusick  * amount of real time.  You probably shouldn't change this;
11741474Smckusick  * it is used in subtle ways (fractions and multiples of it are, that is, like
11841474Smckusick  * half of a ``long time'', almost a long time, etc.)
11941474Smckusick  * It is related to human patience and other factors which don't really
12041474Smckusick  * change over time.
12141474Smckusick  */
12241474Smckusick #define	MAXSLP 		20
12341474Smckusick 
12441474Smckusick /*
12541474Smckusick  * A swapped in process is given a small amount of core without being bothered
12641474Smckusick  * by the page replacement algorithm.  Basically this says that if you are
12741474Smckusick  * swapped in you deserve some resources.  We protect the last SAFERSS
12841474Smckusick  * pages against paging and will just swap you out rather than paging you.
12941474Smckusick  * Note that each process has at least UPAGES+CLSIZE pages which are not
13041474Smckusick  * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
13141474Smckusick  * number just means a swapped in process is given around 25k bytes.
13241474Smckusick  * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
13341474Smckusick  * so we loan each swapped in process memory worth 100$, or just admit
13441474Smckusick  * that we don't consider it worthwhile and swap it out to disk which costs
13541474Smckusick  * $30/mb or about $0.75.
13641474Smckusick  */
13741474Smckusick #define	SAFERSS		4		/* nominal ``small'' resident set size
13841474Smckusick 					   protected against replacement */
13941474Smckusick 
14041474Smckusick /*
14141474Smckusick  * DISKRPM is used to estimate the number of paging i/o operations
14241474Smckusick  * which one can expect from a single disk controller.
14341474Smckusick  */
14441474Smckusick #define	DISKRPM		60
14541474Smckusick 
14641474Smckusick /*
14741474Smckusick  * Klustering constants.  Klustering is the gathering
14841474Smckusick  * of pages together for pagein/pageout, while clustering
14941474Smckusick  * is the treatment of hardware page size as though it were
15041474Smckusick  * larger than it really is.
15141474Smckusick  *
15241474Smckusick  * KLMAX gives maximum cluster size in CLSIZE page (cluster-page)
15341474Smckusick  * units.  Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h.
15441474Smckusick  * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
15541474Smckusick  * unless you like "big push" panics.
15641474Smckusick  */
15741474Smckusick 
15841474Smckusick #define	KLMAX	(4/CLSIZE)
15941474Smckusick #define	KLSEQL	(2/CLSIZE)		/* in klust if vadvise(VA_SEQL) */
16041474Smckusick #define	KLIN	(4/CLSIZE)		/* default data/stack in klust */
16141474Smckusick #define	KLTXT	(4/CLSIZE)		/* default text in klust */
16241474Smckusick #define	KLOUT	(4/CLSIZE)
16341474Smckusick 
16441474Smckusick /*
16541474Smckusick  * KLSDIST is the advance or retard of the fifo reclaim for sequential
16641474Smckusick  * processes data space.
16741474Smckusick  */
16841474Smckusick #define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
16941474Smckusick 
17041474Smckusick /*
17141474Smckusick  * Paging thresholds (see vm_sched.c).
17241474Smckusick  * Strategy of 1/19/85:
17341474Smckusick  *	lotsfree is 512k bytes, but at most 1/4 of memory
17441474Smckusick  *	desfree is 200k bytes, but at most 1/8 of memory
17541474Smckusick  */
17641474Smckusick #define	LOTSFREE	(512 * 1024)
17741474Smckusick #define	LOTSFREEFRACT	4
17841474Smckusick #define	DESFREE		(200 * 1024)
17941474Smckusick #define	DESFREEFRACT	8
18041474Smckusick 
18141474Smckusick /*
18241474Smckusick  * There are two clock hands, initially separated by HANDSPREAD bytes
18341474Smckusick  * (but at most all of user memory).  The amount of time to reclaim
18441474Smckusick  * a page once the pageout process examines it increases with this
18541474Smckusick  * distance and decreases as the scan rate rises.
18641474Smckusick  */
18741474Smckusick #define	HANDSPREAD	(2 * 1024 * 1024)
18841474Smckusick 
18941474Smckusick /*
19041474Smckusick  * The number of times per second to recompute the desired paging rate
19141474Smckusick  * and poke the pagedaemon.
19241474Smckusick  */
19341474Smckusick #define	RATETOSCHEDPAGING	4
19441474Smckusick 
19541474Smckusick /*
19641474Smckusick  * Believed threshold (in megabytes) for which interleaved
19741474Smckusick  * swapping area is desirable.
19841474Smckusick  */
19941474Smckusick #define	LOTSOFMEM	2
20041474Smckusick 
20145755Smckusick /*
20245755Smckusick  * Mach derived constants
20345755Smckusick  */
20445755Smckusick 
20545755Smckusick /* user/kernel map constants */
20645755Smckusick #define VM_MIN_ADDRESS		((vm_offset_t)0)
20749330Shibler #define VM_MAXUSER_ADDRESS	((vm_offset_t)0xFFF00000)
20845755Smckusick #define VM_MAX_ADDRESS		((vm_offset_t)0xFFF00000)
20945755Smckusick #define VM_MIN_KERNEL_ADDRESS	((vm_offset_t)0)
21045755Smckusick #define VM_MAX_KERNEL_ADDRESS	((vm_offset_t)0xFFFFF000)
21145755Smckusick 
21245755Smckusick /* virtual sizes (bytes) for various kernel submaps */
21345755Smckusick #define VM_MBUF_SIZE		(NMBCLUSTERS*MCLBYTES)
21445755Smckusick #define VM_KMEM_SIZE		(NKMEMCLUSTERS*CLBYTES)
21545755Smckusick #define VM_PHYS_SIZE		(USRIOSIZE*CLBYTES)
21645755Smckusick 
21745755Smckusick /* # of kernel PT pages (initial only, can grow dynamically) */
21845755Smckusick #define VM_KERNEL_PT_PAGES	((vm_size_t)2)		/* XXX: SYSPTSIZE */
21945755Smckusick 
22045755Smckusick /* pcb base */
22145755Smckusick #define	pcbb(p)		((u_int)(p)->p_addr)
222