1*49436Sbostic /*- 2*49436Sbostic * Copyright (c) 1982, 1986 The Regents of the University of California. 3*49436Sbostic * All rights reserved. 423280Smckusick * 5*49436Sbostic * %sccs.include.proprietary.c% 6*49436Sbostic * 7*49436Sbostic * @(#)vmparam.h 7.4 (Berkeley) 05/08/91 823280Smckusick */ 99119Ssam 109119Ssam /* 119119Ssam * Machine dependent constants for VAX 129119Ssam */ 139119Ssam /* 149119Ssam * USRTEXT is the start of the user text/data space, while USRSTACK 159119Ssam * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 169119Ssam * the number of pages from the beginning of the P0 region to the 179119Ssam * beginning of the text and from the beginning of the P1 region to the 189119Ssam * beginning of the stack respectively. 199119Ssam */ 209119Ssam #define USRTEXT 0 2116923Smckusick #define USRSTACK (0x80000000-UPAGES*NBPG) /* Start of user stack */ 2216923Smckusick #define BTOPUSRSTACK (0x400000 - UPAGES) /* btop(USRSTACK) */ 2316923Smckusick /* number of ptes per page */ 249119Ssam #define P1PAGES 0x200000 /* number of pages in P1 region */ 259119Ssam #define LOWPAGES 0 269119Ssam #define HIGHPAGES UPAGES 279119Ssam 289119Ssam /* 2925259Skarels * Virtual memory related constants, all in bytes 309119Ssam */ 3125259Skarels #ifndef MAXTSIZ 3225259Skarels #define MAXTSIZ (6*1024*1024) /* max text size */ 3325259Skarels #endif 3418271Skarels #ifndef DFLDSIZ 3525259Skarels #define DFLDSIZ (6*1024*1024) /* initial data size limit */ 3618271Skarels #endif 379119Ssam #ifndef MAXDSIZ 3825259Skarels #define MAXDSIZ (16*1024*1024) /* max data size */ 399119Ssam #endif 4018271Skarels #ifndef DFLSSIZ 4125259Skarels #define DFLSSIZ (512*1024) /* initial stack size limit */ 4218271Skarels #endif 4318271Skarels #ifndef MAXSSIZ 4418271Skarels #define MAXSSIZ MAXDSIZ /* max stack size */ 4518271Skarels #endif 469119Ssam 479119Ssam /* 4818271Skarels * Default sizes of swap allocation chunks (see dmap.h). 4918271Skarels * The actual values may be changed in vminit() based on MAXDSIZ. 5018271Skarels * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 5141522Smckusick * DMMIN should be at least ctod(1) so that vtod() works. 5241522Smckusick * vminit() ensures this. 5318271Skarels */ 5418271Skarels #define DMMIN 32 /* smallest swap allocation */ 5518271Skarels #define DMMAX 4096 /* largest potential swap allocation */ 5618271Skarels #define DMTEXT 1024 /* swap allocation for text */ 5718271Skarels 5818271Skarels /* 599119Ssam * Sizes of the system and user portions of the system page table. 609119Ssam */ 619119Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 6213445Sroot #define SYSPTSIZE ((20+MAXUSERS)*NPTEPG) 6318271Skarels #define USRPTSIZE (32*NPTEPG) 649119Ssam 659119Ssam /* 6641522Smckusick * PTEs for system V compatible shared memory. 6741522Smckusick * This is basically slop for kmempt which we actually allocate (malloc) from. 6841522Smckusick */ 6941522Smckusick #define SHMMAXPGS 1024 7041522Smckusick 7141522Smckusick /* 7241522Smckusick * Boundary at which to place first MAPMEM segment if not explicitly 7341522Smckusick * specified. Should be a power of two. This allows some slop for 7441522Smckusick * the data segment to grow underneath the first mapped segment. 7541522Smckusick */ 7641522Smckusick #define MMSEG 0x200000 7741522Smckusick 7841522Smckusick /* 799119Ssam * The size of the clock loop. 809119Ssam */ 819119Ssam #define LOOPPAGES (maxfree - firstfree) 829119Ssam 839119Ssam /* 849119Ssam * The time for a process to be blocked before being very swappable. 859119Ssam * This is a number of seconds which the system takes as being a non-trivial 869119Ssam * amount of real time. You probably shouldn't change this; 879119Ssam * it is used in subtle ways (fractions and multiples of it are, that is, like 889119Ssam * half of a ``long time'', almost a long time, etc.) 899119Ssam * It is related to human patience and other factors which don't really 909119Ssam * change over time. 919119Ssam */ 929119Ssam #define MAXSLP 20 939119Ssam 949119Ssam /* 959119Ssam * A swapped in process is given a small amount of core without being bothered 969119Ssam * by the page replacement algorithm. Basically this says that if you are 979119Ssam * swapped in you deserve some resources. We protect the last SAFERSS 989119Ssam * pages against paging and will just swap you out rather than paging you. 999119Ssam * Note that each process has at least UPAGES+CLSIZE pages which are not 1009119Ssam * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 1019119Ssam * number just means a swapped in process is given around 25k bytes. 1029119Ssam * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 1039119Ssam * so we loan each swapped in process memory worth 100$, or just admit 1049119Ssam * that we don't consider it worthwhile and swap it out to disk which costs 1059119Ssam * $30/mb or about $0.75. 1069119Ssam */ 1079119Ssam #define SAFERSS 32 /* nominal ``small'' resident set size 1089119Ssam protected against replacement */ 1099119Ssam 1109119Ssam /* 1119119Ssam * DISKRPM is used to estimate the number of paging i/o operations 1129119Ssam * which one can expect from a single disk controller. 1139119Ssam */ 1149119Ssam #define DISKRPM 60 1159119Ssam 1169119Ssam /* 1179119Ssam * Klustering constants. Klustering is the gathering 1189119Ssam * of pages together for pagein/pageout, while clustering 1199119Ssam * is the treatment of hardware page size as though it were 1209119Ssam * larger than it really is. 1219119Ssam * 1229119Ssam * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 12341522Smckusick * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 12441522Smckusick * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) to 12541522Smckusick * avoid "big push" panics. 1269119Ssam */ 1279119Ssam 1289119Ssam #define KLMAX (32/CLSIZE) 1299119Ssam #define KLSEQL (16/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 1309119Ssam #define KLIN (8/CLSIZE) /* default data/stack in klust */ 1319119Ssam #define KLTXT (4/CLSIZE) /* default text in klust */ 1329119Ssam #define KLOUT (32/CLSIZE) 1339119Ssam 1349119Ssam /* 1359119Ssam * KLSDIST is the advance or retard of the fifo reclaim for sequential 1369119Ssam * processes data space. 1379119Ssam */ 1389119Ssam #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 13913122Ssam 14013122Ssam /* 14113122Ssam * Paging thresholds (see vm_sched.c). 14218264Smckusick * Strategy of 1/19/85: 14318264Smckusick * lotsfree is 512k bytes, but at most 1/4 of memory 14413122Ssam * desfree is 200k bytes, but at most 1/8 of memory 14513122Ssam * minfree is 64k bytes, but at most 1/2 of desfree 14613122Ssam */ 14718264Smckusick #define LOTSFREE (512 * 1024) 14813122Ssam #define LOTSFREEFRACT 4 14913122Ssam #define DESFREE (200 * 1024) 15013122Ssam #define DESFREEFRACT 8 15113122Ssam #define MINFREE (64 * 1024) 15213122Ssam #define MINFREEFRACT 2 15313122Ssam 15413122Ssam /* 15518265Smckusick * There are two clock hands, initially separated by HANDSPREAD bytes 15618265Smckusick * (but at most all of user memory). The amount of time to reclaim 15718265Smckusick * a page once the pageout process examines it increases with this 15818265Smckusick * distance and decreases as the scan rate rises. 15918265Smckusick */ 16018265Smckusick #define HANDSPREAD (2 * 1024 * 1024) 16118265Smckusick 16218265Smckusick /* 16318265Smckusick * The number of times per second to recompute the desired paging rate 16418265Smckusick * and poke the pagedaemon. 16518265Smckusick */ 16618265Smckusick #define RATETOSCHEDPAGING 4 16718265Smckusick 16818265Smckusick /* 16913122Ssam * Believed threshold (in megabytes) for which interleaved 17013122Ssam * swapping area is desirable. 17113122Ssam */ 17213122Ssam #define LOTSOFMEM 2 17313126Ssam 17432699Skarels #define mapin(pte, v, pfnum, prot) \ 17532699Skarels (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v)) 176