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