1*49429Sbostic /*- 2*49429Sbostic * Copyright (c) 1988 The Regents of the University of California. 3*49429Sbostic * All rights reserved. 434408Skarels * 5*49429Sbostic * This code is derived from software contributed to Berkeley by 6*49429Sbostic * Computer Consoles Inc. 7*49429Sbostic * 8*49429Sbostic * %sccs.include.proprietary.c% 9*49429Sbostic * 10*49429Sbostic * @(#)vmparam.h 7.3 (Berkeley) 05/08/91 1134408Skarels */ 1224010Ssam 13*49429Sbostic /*- 1425926Ssam * Machine dependent constants for tahoe. 1524010Ssam */ 1625926Ssam 1724010Ssam /* 1824010Ssam * USRTEXT is the start of the user text/data space, while USRSTACK 1924010Ssam * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 2024010Ssam * the number of pages from the beginning of the P0 region to the 2124010Ssam * beginning of the text and from the beginning of the P2 region to the 2224010Ssam * beginning of the stack respectively. 2324010Ssam */ 2424010Ssam #define USRTEXT 0 2525678Ssam #define USRSTACK (0xc0000000-UPAGES*NBPG) /* Start of user stack */ 2625678Ssam #define BTOPUSRSTACK (0x300000 - UPAGES) /* btop(USRSTACK) */ 2724010Ssam #define P2PAGES 0x100000 /* number of pages in P2 region */ 2824010Ssam #define LOWPAGES 0 2924010Ssam #define HIGHPAGES UPAGES 3024010Ssam 3124010Ssam /* 3225854Ssam * Virtual memory related constants, all in bytes 3324010Ssam */ 3425854Ssam #define MAXTSIZ (6*1024*1024) /* max text size */ 3525678Ssam #ifndef DFLDSIZ 3625854Ssam #define DFLDSIZ (6*1024*1024) /* initial data size limit */ 3725678Ssam #endif 3825678Ssam #ifndef MAXDSIZ 3927184Ssam #define MAXDSIZ (32*1024*1024) /* max data size */ 4025678Ssam #endif 4125678Ssam #ifndef DFLSSIZ 4225854Ssam #define DFLSSIZ (512*1024) /* initial stack size limit */ 4325678Ssam #endif 4425678Ssam #ifndef MAXSSIZ 4525678Ssam #define MAXSSIZ MAXDSIZ /* max stack size */ 4625678Ssam #endif 4724010Ssam 4824010Ssam /* 4925678Ssam * Default sizes of swap allocation chunks (see dmap.h). 5025678Ssam * The actual values may be changed in vminit() based on MAXDSIZ. 5125678Ssam * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 5241521Smckusick * DMMIN should be at least ctod(1) so that vtod() works. 5341521Smckusick * vminit() ensures this. 5425678Ssam */ 5525678Ssam #define DMMIN 32 /* smallest swap allocation */ 5625678Ssam #define DMMAX 4096 /* largest potential swap allocation */ 5725678Ssam #define DMTEXT 1024 /* swap allocation for text */ 5825678Ssam 5925678Ssam /* 6024010Ssam * Sizes of the system and user portions of the system page table. 6124010Ssam */ 6224010Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 6331317Skarels #define SYSPTSIZE ((20+MAXUSERS/2)*NPTEPG) 6425678Ssam #define USRPTSIZE (4*NPTEPG) 6524010Ssam 6624010Ssam /* 6741521Smckusick * PTEs for system V compatible shared memory. 6841521Smckusick * This is basically slop for kmempt which we actually allocate (malloc) from. 6941521Smckusick */ 7041521Smckusick #define SHMMAXPGS 512 7141521Smckusick 7241521Smckusick /* 7341521Smckusick * Boundary at which to place first MAPMEM segment if not explicitly 7441521Smckusick * specified. Should be a power of two. This allows some slop for 7541521Smckusick * the data segment to grow underneath the first mapped segment. 7641521Smckusick */ 7741521Smckusick #define MMSEG 0x200000 7841521Smckusick 7941521Smckusick /* 8024010Ssam * The size of the clock loop. 8124010Ssam */ 8224010Ssam #define LOOPPAGES (maxfree - firstfree) 8324010Ssam 8424010Ssam /* 8524010Ssam * The time for a process to be blocked before being very swappable. 8624010Ssam * This is a number of seconds which the system takes as being a non-trivial 8724010Ssam * amount of real time. You probably shouldn't change this; 8824010Ssam * it is used in subtle ways (fractions and multiples of it are, that is, like 8924010Ssam * half of a ``long time'', almost a long time, etc.) 9024010Ssam * It is related to human patience and other factors which don't really 9124010Ssam * change over time. 9224010Ssam */ 9324010Ssam #define MAXSLP 20 9424010Ssam 9524010Ssam /* 9624010Ssam * A swapped in process is given a small amount of core without being bothered 9724010Ssam * by the page replacement algorithm. Basically this says that if you are 9824010Ssam * swapped in you deserve some resources. We protect the last SAFERSS 9924010Ssam * pages against paging and will just swap you out rather than paging you. 10024010Ssam * Note that each process has at least UPAGES+CLSIZE pages which are not 10124010Ssam * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 10224010Ssam * number just means a swapped in process is given around 25k bytes. 10324010Ssam * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 10424010Ssam * so we loan each swapped in process memory worth 100$, or just admit 10524010Ssam * that we don't consider it worthwhile and swap it out to disk which costs 10624010Ssam * $30/mb or about $0.75. 10724010Ssam */ 10825678Ssam #define SAFERSS 32 /* nominal ``small'' resident set size 10924010Ssam protected against replacement */ 11024010Ssam 11124010Ssam /* 11224010Ssam * DISKRPM is used to estimate the number of paging i/o operations 11324010Ssam * which one can expect from a single disk controller. 11424010Ssam */ 11524010Ssam #define DISKRPM 60 11624010Ssam 11724010Ssam /* 11824010Ssam * Klustering constants. Klustering is the gathering 11924010Ssam * of pages together for pagein/pageout, while clustering 12024010Ssam * is the treatment of hardware page size as though it were 12124010Ssam * larger than it really is. 12224010Ssam * 12324010Ssam * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 12441521Smckusick * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 12541521Smckusick * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) to 12641521Smckusick * avoid "big push" panics. 12724010Ssam */ 12824010Ssam 12924010Ssam #define KLMAX (32/CLSIZE) 13024010Ssam #define KLSEQL (16/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 13124010Ssam #define KLIN (8/CLSIZE) /* default data/stack in klust */ 13224010Ssam #define KLTXT (4/CLSIZE) /* default text in klust */ 13324010Ssam #define KLOUT (32/CLSIZE) 13424010Ssam 13524010Ssam /* 13624010Ssam * KLSDIST is the advance or retard of the fifo reclaim for sequential 13724010Ssam * processes data space. 13824010Ssam */ 13924010Ssam #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 14024010Ssam 14124010Ssam /* 14224010Ssam * Paging thresholds (see vm_sched.c). 14325678Ssam * Strategy of 1/19/85: 14425678Ssam * lotsfree is 512k bytes, but at most 1/4 of memory 14524010Ssam * desfree is 200k bytes, but at most 1/8 of memory 14624010Ssam * minfree is 64k bytes, but at most 1/2 of desfree 14724010Ssam */ 14825678Ssam #define LOTSFREE (512 * 1024) 14924010Ssam #define LOTSFREEFRACT 4 15024010Ssam #define DESFREE (200 * 1024) 15124010Ssam #define DESFREEFRACT 8 15224010Ssam #define MINFREE (64 * 1024) 15324010Ssam #define MINFREEFRACT 2 15424010Ssam 15524010Ssam /* 15625678Ssam * There are two clock hands, initially separated by HANDSPREAD bytes 15725678Ssam * (but at most all of user memory). The amount of time to reclaim 15825678Ssam * a page once the pageout process examines it increases with this 15925678Ssam * distance and decreases as the scan rate rises. 16025678Ssam */ 16125678Ssam #define HANDSPREAD (2 * 1024 * 1024) 16225678Ssam 16325678Ssam /* 16425678Ssam * The number of times per second to recompute the desired paging rate 16525678Ssam * and poke the pagedaemon. 16625678Ssam */ 16725678Ssam #define RATETOSCHEDPAGING 4 16825678Ssam 16925678Ssam /* 17024010Ssam * Believed threshold (in megabytes) for which interleaved 17124010Ssam * swapping area is desirable. 17224010Ssam */ 17324010Ssam #define LOTSOFMEM 2 17424010Ssam 17533285Skarels #define mapin(pte, v, pfnum, prot) \ 17633285Skarels (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v)) 17724010Ssam 17825678Ssam /* 17925678Ssam * Invalidate a cluster (optimized here for standard CLSIZE). 18025678Ssam */ 18125678Ssam #if CLSIZE == 1 18225678Ssam #define tbiscl(v) mtpr(TBIS, ptob(v)) 18325678Ssam #endif 184