date and time created 92/07/22 15:42:17 by bostic
[unix-history] / usr / src / usr.sbin / config / SMM.doc / d.t
CommitLineData
3edcb7c8
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
5eda3e70 3.\"
3edcb7c8
KB
4.\" %sccs.include.redist.roff%
5.\"
6.\" @(#)d.t 6.3 (Berkeley) %G%
5eda3e70 7.\"
57349e41 8.\".ds RH "Data Structure Sizing Rules
5eda3e70 9.bp
5eda3e70
KM
10.LG
11.B
12.ce
13APPENDIX D. VAX KERNEL DATA STRUCTURE SIZING RULES
57349e41 14.sp
5eda3e70
KM
15.R
16.NL
17.PP
18Certain system data structures are sized at compile time
19according to the maximum number of simultaneous users expected,
20while others are calculated at boot time based on the
57349e41 21physical resources present, e.g. memory. This appendix lists
5eda3e70
KM
22both sets of rules and also includes some hints on changing
23built-in limitations on certain data structures.
24.SH
25Compile time rules
26.PP
57349e41 27The file \fI/sys/conf\|/param.c\fP contains the definitions of
5eda3e70
KM
28almost all data structures sized at compile time. This file
29is copied into the directory of each configured system to allow
30configuration-dependent rules and values to be maintained.
57349e41
MK
31(Each copy normally depends on the copy in /sys/conf,
32and global modifications cause the file to be recopied unless
33the makefile is modified.)
5eda3e70
KM
34The rules implied by its contents are summarized below (here
35MAXUSERS refers to the value defined in the configuration file
36in the ``maxusers'' rule).
57349e41
MK
37Most limits are computed at compile time and stored in global variables
38for use by other modules; they may generally be patched in the system
39binary image before rebooting to test new values.
5eda3e70
KM
40.IP \fBnproc\fP
41.br
57349e41
MK
42The maximum number of processes which may be running at any time.
43It is referred to in other calculations as NPROC and is defined to be
44.DS
4520 + 8 * MAXUSERS
46.DE
5eda3e70
KM
47.IP \fBntext\fP
48.br
57349e41
MK
49The maximum number of active shared text segments.
50The constant is intended to allow for network servers and common commands
51that remain in the table.
52It is defined as
53.DS
5436 + MAXUSERS.
55.DE
5eda3e70
KM
56.IP \fBninode\fP
57.br
58The maximum number of files in the file system which may be
59active at any time. This includes files in use by users, as
60well as directory files being read or written by the system
57349e41
MK
61and files associated with bound sockets in the UNIX IPC domain.
62It is defined as
63.DS
64(NPROC + 16 + MAXUSERS) + 32
65.DE
5eda3e70
KM
66.IP \fBnfile\fP
67.br
68The number of ``file table'' structures. One file
69table structure is used for each open, unshared, file descriptor.
70Multiple file descriptors may reference a single file table
71entry when they are created through a \fIdup\fP call, or as the
72result of a \fIfork\fP. This is defined to be
73.DS
57349e41 7416 * (NPROC + 16 + MAXUSERS) / 10 + 32
5eda3e70 75.DE
5eda3e70
KM
76.IP \fBncallout\fP
77.br
78The number of ``callout'' structures. One callout
79structure is used per internal system event handled with
80a timeout. Timeouts are used for terminal delays,
81watchdog routines in device drivers, protocol timeout processing, etc.
57349e41
MK
82This is defined as
83.DS
8416 + NPROC
85.DE
5eda3e70
KM
86.IP \fBnclist\fP
87.br
88The number of ``c-list'' structures. C-list structures are
57349e41
MK
89used in terminal I/O, and currently each holds 60 characters.
90Their number is defined as
91.DS
9260 + 12 * MAXUSERS
93.DE
5eda3e70
KM
94.IP \fBnmbclusters\fP
95.br
96The maximum number of pages which may be allocated by the network.
97This is defined as 256 (a quarter megabyte of memory) in /sys/h/mbuf.h.
98In practice, the network rarely uses this much memory. It starts off
57349e41 99by allocating 8 kilobytes of memory, then requesting more as
5eda3e70
KM
100required. This value represents an upper bound.
101.IP \fBnquota\fP
102.br
103The number of ``quota'' structures allocated. Quota structures
104are present only when disc quotas are configured in the system. One
105quota structure is kept per user. This is defined to be
57349e41
MK
106.DS
107(MAXUSERS * 9) / 7 + 3
108.DE
5eda3e70
KM
109.IP \fBndquot\fP
110.br
111The number of ``dquot'' structures allocated. Dquot structures
112are present only when disc quotas are configured in the system.
113One dquot structure is required per user, per active file system quota.
114That is, when a user manipulates a file on a file system on which
115quotas are enabled, the information regarding the user's quotas on
116that file system must be in-core. This information is cached, so
117that not all information must be present in-core all the time.
57349e41
MK
118This is defined as
119.DS
120NINODE + (MAXUSERS * NMOUNT) / 4
121.DE
122where NMOUNT is the maximum number of mountable file systems.
5eda3e70
KM
123.LP
124In addition to the above values, the system page tables (used to
125map virtual memory in the kernel's address space) are sized at
b6426608 126compile time by the SYSPTSIZE definition in the file /sys/vax/vmparam.h.
57349e41
MK
127This is defined to be
128.DS
12920 + MAXUSERS
130.DE
131pages of page tables.
5eda3e70
KM
132Its definition affects
133the size of many data structures allocated at boot time because
134it constrains the amount of virtual memory which may be addressed
135by the running system. This is often the limiting factor
57349e41
MK
136in the size of the buffer cache, in which case a message is printed
137when the system configures at boot time.
5eda3e70
KM
138.SH
139Run-time calculations
140.PP
141The most important data structures sized at run-time are those used in
57349e41
MK
142the buffer cache. Allocation is done by allocating physical memory
143(and system virtual memory) immediately after the system
5eda3e70
KM
144has been started up; look in the file /sys/vax/machdep.c.
145The amount of physical memory which may be allocated to the buffer
146cache is constrained by the size of the system page tables, among
147other things. While the system may calculate
148a large amount of memory to be allocated to the buffer cache,
149if the system page
150table is too small to map this physical
151memory into the virtual address space
152of the system, only as much as can be mapped will be used.
153.PP
154The buffer cache is comprised of a number of ``buffer headers''
155and a pool of pages attached to these headers. Buffer headers
156are divided into two categories: those used for swapping and
57349e41
MK
157paging, and those used for normal file I/O. The system tries
158to allocate 10% of the first two megabytes and 5% of the remaining
159available physical memory for the buffer
5eda3e70
KM
160cache (where \fIavailable\fP does not count that space occupied by
161the system's text and data segments). If this results in fewer
162than 16 pages of memory allocated, then 16 pages are allocated.
163This value is kept in the initialized variable \fIbufpages\fP
164so that it may be patched in the binary image (to allow tuning
57349e41
MK
165without recompiling the system),
166or the default may be overridden with a configuration-file option.
167For example, the option \fBoptions BUFPAGES="3200"\fP
168causes 3200 pages (3.2M bytes) to be used by the buffer cache.
169A sufficient number of file I/O buffer headers are then allocated
170to allow each to hold 2 pages each.
171Each buffer maps 8K bytes.
172If the number of buffer pages is larger than can be mapped
173by the buffer headers, the number of pages is reduced.
174The number of buffer headers allocated
175is stored in the global variable \fInbuf\fP,
176which may be patched before the system is booted.
177The system option \fBoptions NBUF="1000"\fP forces the allocation
178of 1000 buffer headers.
179Half as many swap I/O buffer headers as file I/O buffers
180are allocated,
181but no more than 256.
5eda3e70
KM
182.SH
183System size limitations
184.PP
185As distributed, the sum of the virtual sizes of the core-resident
57349e41
MK
186processes is limited to 256M bytes. The size of the text
187segment of a single process is currently limited to 6M bytes.
188It may be increased to no greater than the data segment size limit
189(see below) by redefining MAXTSIZ.
190This may be done with a configuration file option,
191e.g. \fBoptions MAXTSIZ="(10*1024*1024)"\fP
192to set the limit to 10 million bytes.
193Other per-process limits discussed here may be changed with similar options
194with names given in parentheses.
195Soft, user-changeable limits are set to 512K bytes for stack (DFLSSIZ)
196and 6M bytes for the data segment (DFLDSIZ) by default;
197these may be increased up to the hard limit
198with the \fIsetrlimit\fP\|(2) system call.
199The data and stack segment size hard limits are set by a system configuration
200option to one of 17M, 33M or 64M bytes.
201One of these sizes is chosen based on the definition of MAXDSIZ;
202with no option, the limit is 17M bytes; with an option
203\fBoptions MAXDSIZ="(32*1024*1024)"\fP (or any value between 17M and 33M),
204the limit is increased to 33M bytes, and values larger than 33M
205result in a limit of 64M bytes.
5eda3e70 206You must be careful in doing this that you have adequate paging space.
57349e41
MK
207As normally configured , the system has 16M or 32M bytes per paging area,
208depending on disk size.
5eda3e70
KM
209The best way to get more space is to provide multiple, thereby
210interleaved, paging areas.
57349e41
MK
211Increasing the virtual memory limits results in interleaving of
212swap space in larger sections (from 500K bytes to 1M or 2M bytes).
5eda3e70 213.PP
57349e41
MK
214By default, the virtual memory system allocates enough memory
215for system page tables mapping user page tables
216to allow 256 megabytes of simultaneous active virtual memory.
217That is, the sum of the virtual memory sizes of all (completely- or partially-)
218resident processes can not exceed this limit.
219If the limit is exceeded, some process(es) must be swapped out.
5eda3e70
KM
220To increase the amount of resident virtual space possible,
221you can alter the constant USRPTSIZE (in
222/sys/vax/vmparam.h).
57349e41 223Each page of system page tables allows 8 megabytes of user virtual memory.
5eda3e70
KM
224.PP
225Because the file system block numbers are stored in
226page table \fIpg_blkno\fP
227entries, the maximum size of a file system is limited to
57349e41 2282^24 1024 byte blocks. Thus no file system can be larger than 8 gigabytes.
5eda3e70 229.PP
57349e41
MK
230The number of mountable file systems is set at 20 by the definition
231of NMOUNT in /sys/h/param.h.
232This should be sufficient; if not, the value can be increased up to 255.
233If you have many disks, it makes sense to make some of
5eda3e70 234them single file systems, and the paging areas don't count in this total.
5eda3e70 235.PP
57349e41
MK
236The limit to the number of files that a process may have open simultaneously
237is set to 64.
238This limit is set by the NOFILE definition in /sys/h/param.h.
239It may be increased arbitrarily, with the caveat that the user structure
240expands by 5 bytes for each file, and thus UPAGES (/sys/vax/machparam.h)
241must be increased accordingly.
b6426608 242.PP
57349e41 243The amount of physical memory is currently limited to 64 Mb
b6426608 244by the size of the index fields in the core-map (/sys/h/cmap.h).
57349e41
MK
245The limit may be increased by following instructions in that file
246to enlarge those fields.