153978Sfujita /* 253978Sfujita * Copyright (c) 1988 University of Utah. 353978Sfujita * Copyright (c) 1992 OMRON Corporation. 463194Sbostic * Copyright (c) 1982, 1986, 1990, 1992, 1993 563194Sbostic * The Regents of the University of California. All rights reserved. 653978Sfujita * 753978Sfujita * This code is derived from software contributed to Berkeley by 853978Sfujita * the Systems Programming Group of the University of Utah Computer 953978Sfujita * Science Department. 1053978Sfujita * 1153978Sfujita * %sccs.include.redist.c% 1253978Sfujita * 1353978Sfujita * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ 1464265Smckusick * from: hp300/include/vmparam.h 8.1 (Berkeley) 6/10/93 1553978Sfujita * 16*67057Smckusick * @(#)vmparam.h 8.3 (Berkeley) 04/22/94 1753978Sfujita */ 1853978Sfujita 1953978Sfujita /* 2053978Sfujita * Machine dependent constants for HP300 2153978Sfujita */ 2253978Sfujita /* 2353978Sfujita * USRTEXT is the start of the user text/data space, while USRSTACK 2453978Sfujita * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 2553978Sfujita * the number of pages from the beginning of the P0 region to the 2653978Sfujita * beginning of the text and from the beginning of the P1 region to the 2753978Sfujita * beginning of the stack respectively. 2853978Sfujita * 2953978Sfujita * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3) 3053978Sfujita * is for HPUX compatibility. Why?? Because HPUX's debuggers 3153978Sfujita * have the user's stack hard-wired at FFF00000 for post-mortems, 3253978Sfujita * and we must be compatible... 3353978Sfujita */ 3453978Sfujita #define USRTEXT 0 3553978Sfujita #define USRSTACK (-HIGHPAGES*NBPG) /* Start of user stack */ 3653978Sfujita #define BTOPUSRSTACK (0x100000-HIGHPAGES) /* btop(USRSTACK) */ 3753978Sfujita #define P1PAGES 0x100000 3853978Sfujita #define LOWPAGES 0 3953978Sfujita #define HIGHPAGES (0x100000/NBPG) 4053978Sfujita 4153978Sfujita /* 4253978Sfujita * In kernel address space, user stack and user structure is mapped at 4353978Sfujita * KERNELSTACK(LUNA only). Because LUNA has only 0x80000000 kernel 4453978Sfujita * address space and last 1G(0x40000000-0x7FFFFFFF) is IO mapping space. 4553978Sfujita * See below VM_MAX_KERNEL_ADDRESS define. 4653978Sfujita */ 4753978Sfujita #define KERNELSTACK 0x3FF00000 4853978Sfujita 4953978Sfujita /* 5053978Sfujita * Virtual memory related constants, all in bytes 5153978Sfujita */ 5253978Sfujita #ifndef MAXTSIZ 5364265Smckusick #define MAXTSIZ (8*1024*1024) /* max text size */ 5453978Sfujita #endif 5553978Sfujita #ifndef DFLDSIZ 5664265Smckusick #define DFLDSIZ (16*1024*1024) /* initial data size limit */ 5753978Sfujita #endif 5853978Sfujita #ifndef MAXDSIZ 5964265Smckusick #define MAXDSIZ (64*1024*1024) /* max data size */ 6053978Sfujita #endif 6153978Sfujita #ifndef DFLSSIZ 6253978Sfujita #define DFLSSIZ (512*1024) /* initial stack size limit */ 6353978Sfujita #endif 6453978Sfujita #ifndef MAXSSIZ 6553978Sfujita #define MAXSSIZ MAXDSIZ /* max stack size */ 6653978Sfujita #endif 6753978Sfujita 6853978Sfujita /* 6953978Sfujita * Default sizes of swap allocation chunks (see dmap.h). 7053978Sfujita * The actual values may be changed in vminit() based on MAXDSIZ. 7153978Sfujita * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 7253978Sfujita * DMMIN should be at least ctod(1) so that vtod() works. 7353978Sfujita * vminit() insures this. 7453978Sfujita */ 7553978Sfujita #define DMMIN 32 /* smallest swap allocation */ 7653978Sfujita #define DMMAX 4096 /* largest potential swap allocation */ 7753978Sfujita 7853978Sfujita /* 7953978Sfujita * Sizes of the system and user portions of the system page table. 8053978Sfujita */ 8153978Sfujita /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 8253978Sfujita #define SYSPTSIZE (2 * NPTEPG) /* 8mb */ 8353978Sfujita #define USRPTSIZE (1 * NPTEPG) /* 4mb */ 8453978Sfujita 8553978Sfujita /* 8653978Sfujita * PTEs for mapping user space into the kernel for phyio operations. 8753978Sfujita * One page is enough to handle 4Mb of simultaneous raw IO operations. 8853978Sfujita */ 8953978Sfujita #ifndef USRIOSIZE 9053978Sfujita #define USRIOSIZE (1 * NPTEPG) /* 4mb */ 9153978Sfujita #endif 9253978Sfujita 9353978Sfujita /* 9453978Sfujita * PTEs for system V style shared memory. 9553978Sfujita * This is basically slop for kmempt which we actually allocate (malloc) from. 9653978Sfujita */ 9753978Sfujita #ifndef SHMMAXPGS 9853978Sfujita #define SHMMAXPGS 1024 /* 4mb */ 9953978Sfujita #endif 10053978Sfujita 10153978Sfujita /* 10253978Sfujita * Boundary at which to place first MAPMEM segment if not explicitly 10353978Sfujita * specified. Should be a power of two. This allows some slop for 10453978Sfujita * the data segment to grow underneath the first mapped segment. 10553978Sfujita */ 10653978Sfujita #define MMSEG 0x200000 10753978Sfujita 10853978Sfujita /* 10953978Sfujita * The size of the clock loop. 11053978Sfujita */ 11153978Sfujita #define LOOPPAGES (maxfree - firstfree) 11253978Sfujita 11353978Sfujita /* 11453978Sfujita * The time for a process to be blocked before being very swappable. 11553978Sfujita * This is a number of seconds which the system takes as being a non-trivial 11653978Sfujita * amount of real time. You probably shouldn't change this; 11753978Sfujita * it is used in subtle ways (fractions and multiples of it are, that is, like 11853978Sfujita * half of a ``long time'', almost a long time, etc.) 11953978Sfujita * It is related to human patience and other factors which don't really 12053978Sfujita * change over time. 12153978Sfujita */ 12253978Sfujita #define MAXSLP 20 12353978Sfujita 12453978Sfujita /* 12553978Sfujita * A swapped in process is given a small amount of core without being bothered 12653978Sfujita * by the page replacement algorithm. Basically this says that if you are 12753978Sfujita * swapped in you deserve some resources. We protect the last SAFERSS 12853978Sfujita * pages against paging and will just swap you out rather than paging you. 12953978Sfujita * Note that each process has at least UPAGES+CLSIZE pages which are not 13053978Sfujita * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 13153978Sfujita * number just means a swapped in process is given around 25k bytes. 13253978Sfujita * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 13353978Sfujita * so we loan each swapped in process memory worth 100$, or just admit 13453978Sfujita * that we don't consider it worthwhile and swap it out to disk which costs 13553978Sfujita * $30/mb or about $0.75. 13653978Sfujita */ 13753978Sfujita #define SAFERSS 4 /* nominal ``small'' resident set size 13853978Sfujita protected against replacement */ 13953978Sfujita 14053978Sfujita /* 14153978Sfujita * DISKRPM is used to estimate the number of paging i/o operations 14253978Sfujita * which one can expect from a single disk controller. 14353978Sfujita */ 14453978Sfujita #define DISKRPM 60 14553978Sfujita 14653978Sfujita /* 14753978Sfujita * Klustering constants. Klustering is the gathering 14853978Sfujita * of pages together for pagein/pageout, while clustering 14953978Sfujita * is the treatment of hardware page size as though it were 15053978Sfujita * larger than it really is. 15153978Sfujita * 15253978Sfujita * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 15353978Sfujita * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 15453978Sfujita * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) 15553978Sfujita * unless you like "big push" panics. 15653978Sfujita */ 15753978Sfujita 15853978Sfujita #define KLMAX (4/CLSIZE) 15953978Sfujita #define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 16053978Sfujita #define KLIN (4/CLSIZE) /* default data/stack in klust */ 16153978Sfujita #define KLTXT (4/CLSIZE) /* default text in klust */ 16253978Sfujita #define KLOUT (4/CLSIZE) 16353978Sfujita 16453978Sfujita /* 16553978Sfujita * KLSDIST is the advance or retard of the fifo reclaim for sequential 16653978Sfujita * processes data space. 16753978Sfujita */ 16853978Sfujita #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 16953978Sfujita 17053978Sfujita /* 17153978Sfujita * Paging thresholds (see vm_sched.c). 17253978Sfujita * Strategy of 1/19/85: 17353978Sfujita * lotsfree is 512k bytes, but at most 1/4 of memory 17453978Sfujita * desfree is 200k bytes, but at most 1/8 of memory 17553978Sfujita */ 17653978Sfujita #define LOTSFREE (512 * 1024) 17753978Sfujita #define LOTSFREEFRACT 4 17853978Sfujita #define DESFREE (200 * 1024) 17953978Sfujita #define DESFREEFRACT 8 18053978Sfujita 18153978Sfujita /* 18253978Sfujita * There are two clock hands, initially separated by HANDSPREAD bytes 18353978Sfujita * (but at most all of user memory). The amount of time to reclaim 18453978Sfujita * a page once the pageout process examines it increases with this 18553978Sfujita * distance and decreases as the scan rate rises. 18653978Sfujita */ 18753978Sfujita #define HANDSPREAD (2 * 1024 * 1024) 18853978Sfujita 18953978Sfujita /* 19053978Sfujita * The number of times per second to recompute the desired paging rate 19153978Sfujita * and poke the pagedaemon. 19253978Sfujita */ 19353978Sfujita #define RATETOSCHEDPAGING 4 19453978Sfujita 19553978Sfujita /* 19653978Sfujita * Believed threshold (in megabytes) for which interleaved 19753978Sfujita * swapping area is desirable. 19853978Sfujita */ 19953978Sfujita #define LOTSOFMEM 2 20053978Sfujita 20153978Sfujita /* 20253978Sfujita * Mach derived constants 20353978Sfujita */ 20453978Sfujita 20553978Sfujita /* user/kernel map constants */ 20653978Sfujita #define VM_MIN_ADDRESS ((vm_offset_t)0) 20753978Sfujita #define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFFF00000) 20853978Sfujita #define VM_MAX_ADDRESS ((vm_offset_t)0xFFF00000) 20953978Sfujita #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0) 21053978Sfujita #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0x7FFFF000) 21153978Sfujita 21253978Sfujita /* virtual sizes (bytes) for various kernel submaps */ 21353978Sfujita #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) 21453978Sfujita #define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) 21553978Sfujita #define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) 21653978Sfujita 21753978Sfujita /* # of kernel PT pages (initial only, can grow dynamically) */ 21853978Sfujita #define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */ 21953978Sfujita 22053978Sfujita /* pcb base */ 22153978Sfujita #define pcbb(p) ((u_int)(p)->p_addr) 222