1*41474Smckusick /* 2*41474Smckusick * Copyright (c) 1988 University of Utah. 3*41474Smckusick * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 4*41474Smckusick * All rights reserved. 5*41474Smckusick * 6*41474Smckusick * This code is derived from software contributed to Berkeley by 7*41474Smckusick * the Systems Programming Group of the University of Utah Computer 8*41474Smckusick * Science Department. 9*41474Smckusick * 10*41474Smckusick * %sccs.include.redist.c% 11*41474Smckusick * 12*41474Smckusick * from: Utah $Hdr: vmparam.h 1.14 89/08/14$ 13*41474Smckusick * 14*41474Smckusick * @(#)vmparam.h 7.1 (Berkeley) 05/08/90 15*41474Smckusick */ 16*41474Smckusick 17*41474Smckusick /* 18*41474Smckusick * Machine dependent constants for HP300 19*41474Smckusick */ 20*41474Smckusick /* 21*41474Smckusick * USRTEXT is the start of the user text/data space, while USRSTACK 22*41474Smckusick * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 23*41474Smckusick * the number of pages from the beginning of the P0 region to the 24*41474Smckusick * beginning of the text and from the beginning of the P1 region to the 25*41474Smckusick * beginning of the stack respectively. 26*41474Smckusick * 27*41474Smckusick * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3) 28*41474Smckusick * is for HPUX compatibility. Why?? Because HPUX's debuggers 29*41474Smckusick * have the user's stack hard-wired at FFF00000 for post-mortems, 30*41474Smckusick * and we must be compatible... 31*41474Smckusick */ 32*41474Smckusick #define USRTEXT 0 33*41474Smckusick #define USRSTACK (-HIGHPAGES*NBPG) /* Start of user stack */ 34*41474Smckusick #define BTOPUSRSTACK (0x100000-HIGHPAGES) /* btop(USRSTACK) */ 35*41474Smckusick #define P1PAGES 0x100000 36*41474Smckusick #define LOWPAGES 0 37*41474Smckusick #define HIGHPAGES (0x100000/NBPG) 38*41474Smckusick 39*41474Smckusick /* 40*41474Smckusick * Virtual memory related constants, all in bytes 41*41474Smckusick */ 42*41474Smckusick #ifndef MAXTSIZ 43*41474Smckusick #define MAXTSIZ (6*1024*1024) /* max text size */ 44*41474Smckusick #endif 45*41474Smckusick #ifndef DFLDSIZ 46*41474Smckusick #define DFLDSIZ (8*1024*1024) /* initial data size limit */ 47*41474Smckusick #endif 48*41474Smckusick #ifndef MAXDSIZ 49*41474Smckusick #define MAXDSIZ (16*1024*1024) /* max data size */ 50*41474Smckusick #endif 51*41474Smckusick #ifndef DFLSSIZ 52*41474Smckusick #define DFLSSIZ (512*1024) /* initial stack size limit */ 53*41474Smckusick #endif 54*41474Smckusick #ifndef MAXSSIZ 55*41474Smckusick #define MAXSSIZ MAXDSIZ /* max stack size */ 56*41474Smckusick #endif 57*41474Smckusick 58*41474Smckusick /* 59*41474Smckusick * Default sizes of swap allocation chunks (see dmap.h). 60*41474Smckusick * The actual values may be changed in vminit() based on MAXDSIZ. 61*41474Smckusick * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 62*41474Smckusick * DMMIN should be at least ctod(1) so that vtod() works. 63*41474Smckusick * vminit() insures this. 64*41474Smckusick */ 65*41474Smckusick #define DMMIN 32 /* smallest swap allocation */ 66*41474Smckusick #define DMMAX 4096 /* largest potential swap allocation */ 67*41474Smckusick #define DMTEXT 1024 /* swap allocation for text */ 68*41474Smckusick 69*41474Smckusick /* 70*41474Smckusick * Sizes of the system and user portions of the system page table. 71*41474Smckusick */ 72*41474Smckusick /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 73*41474Smckusick #define SYSPTSIZE (2 * NPTEPG) 74*41474Smckusick #define USRPTSIZE (1 * NPTEPG) 75*41474Smckusick 76*41474Smckusick /* 77*41474Smckusick * PTEs for mapping user space into kernel for phyio operations. 78*41474Smckusick * One page is enough to handle 4Mb of simultaneous raw IO operations. 79*41474Smckusick */ 80*41474Smckusick #define USRIOSIZE (1 * NPTEPG) 81*41474Smckusick 82*41474Smckusick /* 83*41474Smckusick * PTEs for system V style shared memory. 84*41474Smckusick * This is basically slop for kmempt which we actually allocate (malloc) from. 85*41474Smckusick */ 86*41474Smckusick #define SHMMAXPGS 1024 87*41474Smckusick 88*41474Smckusick /* 89*41474Smckusick * Boundary at which to place first MAPMEM segment if not explicitly 90*41474Smckusick * specified. Should be a power of two. This allows some slop for 91*41474Smckusick * the data segment to grow underneath the first mapped segment. 92*41474Smckusick */ 93*41474Smckusick #define MMSEG 0x200000 94*41474Smckusick 95*41474Smckusick /* 96*41474Smckusick * The size of the clock loop. 97*41474Smckusick */ 98*41474Smckusick #define LOOPPAGES (maxfree - firstfree) 99*41474Smckusick 100*41474Smckusick /* 101*41474Smckusick * The time for a process to be blocked before being very swappable. 102*41474Smckusick * This is a number of seconds which the system takes as being a non-trivial 103*41474Smckusick * amount of real time. You probably shouldn't change this; 104*41474Smckusick * it is used in subtle ways (fractions and multiples of it are, that is, like 105*41474Smckusick * half of a ``long time'', almost a long time, etc.) 106*41474Smckusick * It is related to human patience and other factors which don't really 107*41474Smckusick * change over time. 108*41474Smckusick */ 109*41474Smckusick #define MAXSLP 20 110*41474Smckusick 111*41474Smckusick /* 112*41474Smckusick * A swapped in process is given a small amount of core without being bothered 113*41474Smckusick * by the page replacement algorithm. Basically this says that if you are 114*41474Smckusick * swapped in you deserve some resources. We protect the last SAFERSS 115*41474Smckusick * pages against paging and will just swap you out rather than paging you. 116*41474Smckusick * Note that each process has at least UPAGES+CLSIZE pages which are not 117*41474Smckusick * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 118*41474Smckusick * number just means a swapped in process is given around 25k bytes. 119*41474Smckusick * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 120*41474Smckusick * so we loan each swapped in process memory worth 100$, or just admit 121*41474Smckusick * that we don't consider it worthwhile and swap it out to disk which costs 122*41474Smckusick * $30/mb or about $0.75. 123*41474Smckusick */ 124*41474Smckusick #define SAFERSS 4 /* nominal ``small'' resident set size 125*41474Smckusick protected against replacement */ 126*41474Smckusick 127*41474Smckusick /* 128*41474Smckusick * DISKRPM is used to estimate the number of paging i/o operations 129*41474Smckusick * which one can expect from a single disk controller. 130*41474Smckusick */ 131*41474Smckusick #define DISKRPM 60 132*41474Smckusick 133*41474Smckusick /* 134*41474Smckusick * Klustering constants. Klustering is the gathering 135*41474Smckusick * of pages together for pagein/pageout, while clustering 136*41474Smckusick * is the treatment of hardware page size as though it were 137*41474Smckusick * larger than it really is. 138*41474Smckusick * 139*41474Smckusick * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 140*41474Smckusick * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 141*41474Smckusick * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) 142*41474Smckusick * unless you like "big push" panics. 143*41474Smckusick */ 144*41474Smckusick 145*41474Smckusick #define KLMAX (4/CLSIZE) 146*41474Smckusick #define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 147*41474Smckusick #define KLIN (4/CLSIZE) /* default data/stack in klust */ 148*41474Smckusick #define KLTXT (4/CLSIZE) /* default text in klust */ 149*41474Smckusick #define KLOUT (4/CLSIZE) 150*41474Smckusick 151*41474Smckusick /* 152*41474Smckusick * KLSDIST is the advance or retard of the fifo reclaim for sequential 153*41474Smckusick * processes data space. 154*41474Smckusick */ 155*41474Smckusick #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 156*41474Smckusick 157*41474Smckusick /* 158*41474Smckusick * Paging thresholds (see vm_sched.c). 159*41474Smckusick * Strategy of 1/19/85: 160*41474Smckusick * lotsfree is 512k bytes, but at most 1/4 of memory 161*41474Smckusick * desfree is 200k bytes, but at most 1/8 of memory 162*41474Smckusick * minfree is 64k bytes, but at most 1/2 of desfree 163*41474Smckusick */ 164*41474Smckusick #define LOTSFREE (512 * 1024) 165*41474Smckusick #define LOTSFREEFRACT 4 166*41474Smckusick #define DESFREE (200 * 1024) 167*41474Smckusick #define DESFREEFRACT 8 168*41474Smckusick #define MINFREE (64 * 1024) 169*41474Smckusick #define MINFREEFRACT 2 170*41474Smckusick 171*41474Smckusick /* 172*41474Smckusick * There are two clock hands, initially separated by HANDSPREAD bytes 173*41474Smckusick * (but at most all of user memory). The amount of time to reclaim 174*41474Smckusick * a page once the pageout process examines it increases with this 175*41474Smckusick * distance and decreases as the scan rate rises. 176*41474Smckusick */ 177*41474Smckusick #define HANDSPREAD (2 * 1024 * 1024) 178*41474Smckusick 179*41474Smckusick /* 180*41474Smckusick * The number of times per second to recompute the desired paging rate 181*41474Smckusick * and poke the pagedaemon. 182*41474Smckusick */ 183*41474Smckusick #define RATETOSCHEDPAGING 4 184*41474Smckusick 185*41474Smckusick /* 186*41474Smckusick * Believed threshold (in megabytes) for which interleaved 187*41474Smckusick * swapping area is desirable. 188*41474Smckusick */ 189*41474Smckusick #define LOTSOFMEM 2 190*41474Smckusick 191*41474Smckusick #define mapin(pte, v, pfnum, prot) \ 192*41474Smckusick (*(u_int *)(pte) = ((pfnum) << PGSHIFT) | (prot), TBIS((caddr_t)(v))) 193