vmparam.h revision 1.1
11.1Stsutsui/*	$NetBSD: vmparam.h,v 1.1 1999/12/09 14:53:14 tsutsui Exp $	*/
21.1Stsutsui
31.1Stsutsui/*
41.1Stsutsui * Copyright (c) 1988 University of Utah.
51.1Stsutsui * Copyright (c) 1982, 1986, 1990, 1993
61.1Stsutsui *	The Regents of the University of California.  All rights reserved.
71.1Stsutsui *
81.1Stsutsui * This code is derived from software contributed to Berkeley by
91.1Stsutsui * the Systems Programming Group of the University of Utah Computer
101.1Stsutsui * Science Department.
111.1Stsutsui *
121.1Stsutsui * Redistribution and use in source and binary forms, with or without
131.1Stsutsui * modification, are permitted provided that the following conditions
141.1Stsutsui * are met:
151.1Stsutsui * 1. Redistributions of source code must retain the above copyright
161.1Stsutsui *    notice, this list of conditions and the following disclaimer.
171.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
181.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
191.1Stsutsui *    documentation and/or other materials provided with the distribution.
201.1Stsutsui * 3. All advertising materials mentioning features or use of this software
211.1Stsutsui *    must display the following acknowledgement:
221.1Stsutsui *	This product includes software developed by the University of
231.1Stsutsui *	California, Berkeley and its contributors.
241.1Stsutsui * 4. Neither the name of the University nor the names of its contributors
251.1Stsutsui *    may be used to endorse or promote products derived from this software
261.1Stsutsui *    without specific prior written permission.
271.1Stsutsui *
281.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.1Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.1Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.1Stsutsui * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.1Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.1Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.1Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.1Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.1Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.1Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.1Stsutsui * SUCH DAMAGE.
391.1Stsutsui *
401.1Stsutsui * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
411.1Stsutsui *
421.1Stsutsui *	@(#)vmparam.h	8.2 (Berkeley) 4/19/94
431.1Stsutsui */
441.1Stsutsui
451.1Stsutsui#ifndef _NEWS68K_VMPARAM_H_
461.1Stsutsui#define	_NEWS68K_VMPARAM_H_
471.1Stsutsui
481.1Stsutsui/*
491.1Stsutsui * Machine dependent constants for news68k
501.1Stsutsui */
511.1Stsutsui
521.1Stsutsui/*
531.1Stsutsui * USRTEXT is the start of the user text/data space, while USRSTACK
541.1Stsutsui * is the top (end) of the user stack.  LOWPAGES and HIGHPAGES are
551.1Stsutsui * the number of pages from the beginning of the P0 region to the
561.1Stsutsui * beginning of the text and from the beginning of the P1 region to the
571.1Stsutsui * beginning of the stack respectively.
581.1Stsutsui *
591.1Stsutsui * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
601.1Stsutsui * is for HPUX compatibility.  Why??  Because HPUX's debuggers
611.1Stsutsui * have the user's stack hard-wired at FFF00000 for post-mortems,
621.1Stsutsui * and we must be compatible...
631.1Stsutsui */
641.1Stsutsui#define	USRTEXT		8192			/* Must equal __LDPGSZ */
651.1Stsutsui#define	USRSTACK	(-HIGHPAGES*NBPG)	/* Start of user stack */
661.1Stsutsui#define	BTOPUSRSTACK	(0x100000-HIGHPAGES)	/* btop(USRSTACK) */
671.1Stsutsui#define P1PAGES		0x100000
681.1Stsutsui#define	LOWPAGES	0
691.1Stsutsui#define HIGHPAGES	(0x100000/NBPG)
701.1Stsutsui
711.1Stsutsui/*
721.1Stsutsui * Virtual memory related constants, all in bytes
731.1Stsutsui */
741.1Stsutsui#ifndef MAXTSIZ
751.1Stsutsui#define	MAXTSIZ		(8*1024*1024)		/* max text size */
761.1Stsutsui#endif
771.1Stsutsui#ifndef DFLDSIZ
781.1Stsutsui#define	DFLDSIZ		(16*1024*1024)		/* initial data size limit */
791.1Stsutsui#endif
801.1Stsutsui#ifndef MAXDSIZ
811.1Stsutsui#define	MAXDSIZ		(64*1024*1024)		/* max data size */
821.1Stsutsui#endif
831.1Stsutsui#ifndef	DFLSSIZ
841.1Stsutsui#define	DFLSSIZ		(512*1024)		/* initial stack size limit */
851.1Stsutsui#endif
861.1Stsutsui#ifndef	MAXSSIZ
871.1Stsutsui#define	MAXSSIZ		MAXDSIZ			/* max stack size */
881.1Stsutsui#endif
891.1Stsutsui
901.1Stsutsui/*
911.1Stsutsui * Sizes of the system and user portions of the system page table.
921.1Stsutsui */
931.1Stsutsui/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
941.1Stsutsui#define	SYSPTSIZE	(2 * NPTEPG)	/* 8mb */
951.1Stsutsui#define	USRPTSIZE 	(1 * NPTEPG)	/* 4mb */
961.1Stsutsui
971.1Stsutsui/*
981.1Stsutsui * PTEs for mapping user space into the kernel for phyio operations.
991.1Stsutsui * One page is enough to handle 4Mb of simultaneous raw IO operations.
1001.1Stsutsui */
1011.1Stsutsui#ifndef USRIOSIZE
1021.1Stsutsui#define USRIOSIZE	(1 * NPTEPG)	/* 4mb */
1031.1Stsutsui#endif
1041.1Stsutsui
1051.1Stsutsui/*
1061.1Stsutsui * PTEs for system V style shared memory.
1071.1Stsutsui * This is basically slop for kmempt which we actually allocate (malloc) from.
1081.1Stsutsui */
1091.1Stsutsui#ifndef SHMMAXPGS
1101.1Stsutsui#define SHMMAXPGS	1024		/* 4mb */
1111.1Stsutsui#endif
1121.1Stsutsui
1131.1Stsutsui/*
1141.1Stsutsui * Boundary at which to place first MAPMEM segment if not explicitly
1151.1Stsutsui * specified.  Should be a power of two.  This allows some slop for
1161.1Stsutsui * the data segment to grow underneath the first mapped segment.
1171.1Stsutsui */
1181.1Stsutsui#define MMSEG		0x200000
1191.1Stsutsui
1201.1Stsutsui/*
1211.1Stsutsui * The size of the clock loop.
1221.1Stsutsui */
1231.1Stsutsui#define	LOOPPAGES	(maxfree - firstfree)
1241.1Stsutsui
1251.1Stsutsui/*
1261.1Stsutsui * The time for a process to be blocked before being very swappable.
1271.1Stsutsui * This is a number of seconds which the system takes as being a non-trivial
1281.1Stsutsui * amount of real time.  You probably shouldn't change this;
1291.1Stsutsui * it is used in subtle ways (fractions and multiples of it are, that is, like
1301.1Stsutsui * half of a ``long time'', almost a long time, etc.)
1311.1Stsutsui * It is related to human patience and other factors which don't really
1321.1Stsutsui * change over time.
1331.1Stsutsui */
1341.1Stsutsui#define	MAXSLP 		20
1351.1Stsutsui
1361.1Stsutsui/*
1371.1Stsutsui * A swapped in process is given a small amount of core without being bothered
1381.1Stsutsui * by the page replacement algorithm.  Basically this says that if you are
1391.1Stsutsui * swapped in you deserve some resources.  We protect the last SAFERSS
1401.1Stsutsui * pages against paging and will just swap you out rather than paging you.
1411.1Stsutsui * Note that each process has at least UPAGES pages which are not
1421.1Stsutsui * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this
1431.1Stsutsui * number just means a swapped in process is given around 25k bytes.
1441.1Stsutsui * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81),
1451.1Stsutsui * so we loan each swapped in process memory worth 100$, or just admit
1461.1Stsutsui * that we don't consider it worthwhile and swap it out to disk which costs
1471.1Stsutsui * $30/mb or about $0.75.
1481.1Stsutsui * Update: memory prices have changed recently (9/96). At the current
1491.1Stsutsui * value of $6 per megabyte, we lend each swapped in process memory worth
1501.1Stsutsui * $0.15, or just admit that we don't consider it worthwhile and swap it out
1511.1Stsutsui * to disk which costs $0.20/MB, or just under half a cent.
1521.1Stsutsui */
1531.1Stsutsui#define	SAFERSS		4		/* nominal ``small'' resident set size
1541.1Stsutsui					   protected against replacement */
1551.1Stsutsui
1561.1Stsutsui/*
1571.1Stsutsui * DISKRPM is used to estimate the number of paging i/o operations
1581.1Stsutsui * which one can expect from a single disk controller.
1591.1Stsutsui */
1601.1Stsutsui#define	DISKRPM		60
1611.1Stsutsui
1621.1Stsutsui/*
1631.1Stsutsui * Klustering constants.  Klustering is the gathering
1641.1Stsutsui * of pages together for pagein/pageout, while clustering
1651.1Stsutsui * is the treatment of hardware page size as though it were
1661.1Stsutsui * larger than it really is.
1671.1Stsutsui *
1681.1Stsutsui * KLMAX gives maximum cluster size in page
1691.1Stsutsui * units.  Note that ctod(KLMAX) must be <= DMMIN in dmap.h.
1701.1Stsutsui * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c)
1711.1Stsutsui * unless you like "big push" panics.
1721.1Stsutsui */
1731.1Stsutsui
1741.1Stsutsui#define	KLMAX	4
1751.1Stsutsui#define	KLSEQL	2			/* in klust if vadvise(VA_SEQL) */
1761.1Stsutsui#define	KLIN	4			/* default data/stack in klust */
1771.1Stsutsui#define	KLTXT	4			/* default text in klust */
1781.1Stsutsui#define	KLOUT	4
1791.1Stsutsui
1801.1Stsutsui/*
1811.1Stsutsui * KLSDIST is the advance or retard of the fifo reclaim for sequential
1821.1Stsutsui * processes data space.
1831.1Stsutsui */
1841.1Stsutsui#define	KLSDIST	3		/* klusters advance/retard for seq. fifo */
1851.1Stsutsui
1861.1Stsutsui/*
1871.1Stsutsui * Paging thresholds (see vm_sched.c).
1881.1Stsutsui * Strategy of 1/19/85:
1891.1Stsutsui *	lotsfree is 512k bytes, but at most 1/4 of memory
1901.1Stsutsui *	desfree is 200k bytes, but at most 1/8 of memory
1911.1Stsutsui */
1921.1Stsutsui#define	LOTSFREE	(512 * 1024)
1931.1Stsutsui#define	LOTSFREEFRACT	4
1941.1Stsutsui#define	DESFREE		(200 * 1024)
1951.1Stsutsui#define	DESFREEFRACT	8
1961.1Stsutsui
1971.1Stsutsui/*
1981.1Stsutsui * There are two clock hands, initially separated by HANDSPREAD bytes
1991.1Stsutsui * (but at most all of user memory).  The amount of time to reclaim
2001.1Stsutsui * a page once the pageout process examines it increases with this
2011.1Stsutsui * distance and decreases as the scan rate rises.
2021.1Stsutsui */
2031.1Stsutsui#define	HANDSPREAD	(2 * 1024 * 1024)
2041.1Stsutsui
2051.1Stsutsui/*
2061.1Stsutsui * The number of times per second to recompute the desired paging rate
2071.1Stsutsui * and poke the pagedaemon.
2081.1Stsutsui */
2091.1Stsutsui#define	RATETOSCHEDPAGING	4
2101.1Stsutsui
2111.1Stsutsui/*
2121.1Stsutsui * Believed threshold (in megabytes) for which interleaved
2131.1Stsutsui * swapping area is desirable.
2141.1Stsutsui */
2151.1Stsutsui#define	LOTSOFMEM	2
2161.1Stsutsui
2171.1Stsutsui/*
2181.1Stsutsui * Mach derived constants
2191.1Stsutsui */
2201.1Stsutsui
2211.1Stsutsui/* user/kernel map constants */
2221.1Stsutsui#define VM_MIN_ADDRESS		((vaddr_t)0)
2231.1Stsutsui#define VM_MAXUSER_ADDRESS	((vaddr_t)0xFFF00000)
2241.1Stsutsui#define VM_MAX_ADDRESS		((vaddr_t)0xFFF00000)
2251.1Stsutsui#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0)
2261.1Stsutsui#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xFFFFF000)
2271.1Stsutsui
2281.1Stsutsui/* virtual sizes (bytes) for various kernel submaps */
2291.1Stsutsui#define VM_KMEM_SIZE		(NKMEMCLUSTERS*NBPG)
2301.1Stsutsui#define VM_PHYS_SIZE		(USRIOSIZE*NBPG)
2311.1Stsutsui
2321.1Stsutsui/* # of kernel PT pages (initial only, can grow dynamically) */
2331.1Stsutsui#define VM_KERNEL_PT_PAGES	((vsize_t)2)		/* XXX: SYSPTSIZE */
2341.1Stsutsui
2351.1Stsutsui/* pcb base */
2361.1Stsutsui#define	pcbb(p)		((u_int)(p)->p_addr)
2371.1Stsutsui
2381.1Stsutsui/*
2391.1Stsutsui * Constants which control the way the VM system deals with memory segments.
2401.1Stsutsui * The news68k only has one physical memory segment?
2411.1Stsutsui */
2421.1Stsutsui#define	VM_PHYSSEG_MAX		1
2431.1Stsutsui#define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
2441.1Stsutsui#define	VM_PHYSSEG_NOADD
2451.1Stsutsui
2461.1Stsutsui#define	VM_NFREELIST		1
2471.1Stsutsui#define	VM_FREELIST_DEFAULT	0
2481.1Stsutsui
2491.1Stsutsui/*
2501.1Stsutsui * pmap-specific data stored in the vm_physmem[] array.
2511.1Stsutsui */
2521.1Stsutsuistruct pmap_physseg {
2531.1Stsutsui	struct pv_entry *pvent;		/* pv table for this seg */
2541.1Stsutsui	char *attrs;			/* page attributes for this seg */
2551.1Stsutsui};
2561.1Stsutsui
2571.1Stsutsui#endif /* _NEWS68K_VMPARAM_H_ */
258