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