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