1*23280Smckusick /* 2*23280Smckusick * Copyright (c) 1982 Regents of the University of California. 3*23280Smckusick * All rights reserved. The Berkeley software License Agreement 4*23280Smckusick * specifies the terms and conditions for redistribution. 5*23280Smckusick * 6*23280Smckusick * @(#)vmparam.h 6.6 (Berkeley) 06/08/85 7*23280Smckusick */ 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 /* 2818271Skarels * Virtual memory related constants, all in clicks 299119Ssam */ 3018271Skarels #define MAXTSIZ (6*CLSIZE*1024) /* max text size */ 3118271Skarels #ifndef DFLDSIZ 3218271Skarels #define DFLDSIZ (6*1024*1024/NBPG) /* initial data size limit */ 3318271Skarels #endif 349119Ssam #ifndef MAXDSIZ 3518271Skarels #define MAXDSIZ (16*1024*1024/NBPG) /* max data size */ 369119Ssam #endif 3718271Skarels #ifndef DFLSSIZ 3818271Skarels #define DFLSSIZ (512*1024/NBPG) /* initial stack size limit */ 3918271Skarels #endif 4018271Skarels #ifndef MAXSSIZ 4118271Skarels #define MAXSSIZ MAXDSIZ /* max stack size */ 4218271Skarels #endif 439119Ssam 449119Ssam /* 4518271Skarels * Default sizes of swap allocation chunks (see dmap.h). 4618271Skarels * The actual values may be changed in vminit() based on MAXDSIZ. 4718271Skarels * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 4818271Skarels */ 4918271Skarels #define DMMIN 32 /* smallest swap allocation */ 5018271Skarels #define DMMAX 4096 /* largest potential swap allocation */ 5118271Skarels #define DMTEXT 1024 /* swap allocation for text */ 5218271Skarels 5318271Skarels /* 549119Ssam * Sizes of the system and user portions of the system page table. 559119Ssam */ 569119Ssam /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 5713445Sroot #define SYSPTSIZE ((20+MAXUSERS)*NPTEPG) 5818271Skarels #define USRPTSIZE (32*NPTEPG) 599119Ssam 609119Ssam /* 619119Ssam * The size of the clock loop. 629119Ssam */ 639119Ssam #define LOOPPAGES (maxfree - firstfree) 649119Ssam 659119Ssam /* 669119Ssam * The time for a process to be blocked before being very swappable. 679119Ssam * This is a number of seconds which the system takes as being a non-trivial 689119Ssam * amount of real time. You probably shouldn't change this; 699119Ssam * it is used in subtle ways (fractions and multiples of it are, that is, like 709119Ssam * half of a ``long time'', almost a long time, etc.) 719119Ssam * It is related to human patience and other factors which don't really 729119Ssam * change over time. 739119Ssam */ 749119Ssam #define MAXSLP 20 759119Ssam 769119Ssam /* 779119Ssam * A swapped in process is given a small amount of core without being bothered 789119Ssam * by the page replacement algorithm. Basically this says that if you are 799119Ssam * swapped in you deserve some resources. We protect the last SAFERSS 809119Ssam * pages against paging and will just swap you out rather than paging you. 819119Ssam * Note that each process has at least UPAGES+CLSIZE pages which are not 829119Ssam * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 839119Ssam * number just means a swapped in process is given around 25k bytes. 849119Ssam * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 859119Ssam * so we loan each swapped in process memory worth 100$, or just admit 869119Ssam * that we don't consider it worthwhile and swap it out to disk which costs 879119Ssam * $30/mb or about $0.75. 889119Ssam */ 899119Ssam #define SAFERSS 32 /* nominal ``small'' resident set size 909119Ssam protected against replacement */ 919119Ssam 929119Ssam /* 939119Ssam * DISKRPM is used to estimate the number of paging i/o operations 949119Ssam * which one can expect from a single disk controller. 959119Ssam */ 969119Ssam #define DISKRPM 60 979119Ssam 989119Ssam /* 999119Ssam * Klustering constants. Klustering is the gathering 1009119Ssam * of pages together for pagein/pageout, while clustering 1019119Ssam * is the treatment of hardware page size as though it were 1029119Ssam * larger than it really is. 1039119Ssam * 1049119Ssam * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 1059119Ssam * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h. 1069119Ssam */ 1079119Ssam 1089119Ssam #define KLMAX (32/CLSIZE) 1099119Ssam #define KLSEQL (16/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 1109119Ssam #define KLIN (8/CLSIZE) /* default data/stack in klust */ 1119119Ssam #define KLTXT (4/CLSIZE) /* default text in klust */ 1129119Ssam #define KLOUT (32/CLSIZE) 1139119Ssam 1149119Ssam /* 1159119Ssam * KLSDIST is the advance or retard of the fifo reclaim for sequential 1169119Ssam * processes data space. 1179119Ssam */ 1189119Ssam #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 11913122Ssam 12013122Ssam /* 12113122Ssam * Paging thresholds (see vm_sched.c). 12218264Smckusick * Strategy of 1/19/85: 12318264Smckusick * lotsfree is 512k bytes, but at most 1/4 of memory 12413122Ssam * desfree is 200k bytes, but at most 1/8 of memory 12513122Ssam * minfree is 64k bytes, but at most 1/2 of desfree 12613122Ssam */ 12718264Smckusick #define LOTSFREE (512 * 1024) 12813122Ssam #define LOTSFREEFRACT 4 12913122Ssam #define DESFREE (200 * 1024) 13013122Ssam #define DESFREEFRACT 8 13113122Ssam #define MINFREE (64 * 1024) 13213122Ssam #define MINFREEFRACT 2 13313122Ssam 13413122Ssam /* 13518265Smckusick * There are two clock hands, initially separated by HANDSPREAD bytes 13618265Smckusick * (but at most all of user memory). The amount of time to reclaim 13718265Smckusick * a page once the pageout process examines it increases with this 13818265Smckusick * distance and decreases as the scan rate rises. 13918265Smckusick */ 14018265Smckusick #define HANDSPREAD (2 * 1024 * 1024) 14118265Smckusick 14218265Smckusick /* 14318265Smckusick * The number of times per second to recompute the desired paging rate 14418265Smckusick * and poke the pagedaemon. 14518265Smckusick */ 14618265Smckusick #define RATETOSCHEDPAGING 4 14718265Smckusick 14818265Smckusick /* 14913122Ssam * Believed threshold (in megabytes) for which interleaved 15013122Ssam * swapping area is desirable. 15113122Ssam */ 15213122Ssam #define LOTSOFMEM 2 15313126Ssam 15413126Ssam /* 15513126Ssam * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1 15613126Ssam */ 15713126Ssam #define mapin(pte, v, pfnum, count, prot) \ 15813126Ssam (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v))) 159