Commit | Line | Data |
---|---|---|
c557cacd C |
1 | .ds LH "Building Systems With Config |
2 | .ds RH "Data Structure Sizing Rules | |
3 | .ds CF July 27, 1983 | |
4 | .LP | |
5 | .nr H1 1 | |
6 | .ds CH " | |
7 | .bp | |
8 | .ds CH "\(hy \\n(PN \(hy | |
9 | .LG | |
10 | .B | |
11 | .ce | |
12 | APPENDIX D. VAX KERNEL DATA STRUCTURE SIZING RULES | |
13 | .sp 2 | |
14 | .R | |
15 | .NL | |
16 | .PP | |
17 | Certain system data structures are sized at compile time | |
18 | according to the maximum number of simultaneous users expected, | |
19 | while others are calculated at boot time based on the | |
20 | physical resources present; e.g. memory. This appendix lists | |
21 | both sets of rules and also includes some hints on changing | |
22 | built-in limitations on certain data structures. | |
23 | .SH | |
24 | Compile time rules | |
25 | .PP | |
26 | The file \fI/sys/conf/param.c\fP contains the definitions of | |
27 | almost all data structures sized at compile time. This file | |
28 | is copied into the directory of each configured system to allow | |
29 | configuration-dependent rules and values to be maintained. | |
30 | The rules implied by its contents are summarized below (here | |
31 | MAXUSERS refers to the value defined in the configuration file | |
32 | in the ``maxusers'' rule). | |
33 | .IP \fBnproc\fP | |
34 | .br | |
35 | The maximum number of processes which may be running at | |
36 | any time. It is defined to be 20 + 8 * MAXUSERS and referred | |
37 | to in other calculations as NPROC. | |
38 | .IP \fBntext\fP | |
39 | .br | |
40 | The maximum number of active shared text segments. Defined as | |
41 | 24 + MAXUSERS + NETSLOP, where NETSLOP is 20 when the Internet | |
42 | protocols are configured in the system and 0 otherwise. The | |
43 | added size for supporting the network is to take into account | |
44 | the numerous server processes which are likely to exist. | |
45 | .IP \fBninode\fP | |
46 | .br | |
47 | The maximum number of files in the file system which may be | |
48 | active at any time. This includes files in use by users, as | |
49 | well as directory files being read or written by the system | |
50 | and files associated with bound sockets in the UNIX ipc domain. | |
51 | This is defined as (NPROC + 16 + MAXUSERS) + 32. | |
52 | .IP \fBnfile\fP | |
53 | .br | |
54 | The number of ``file table'' structures. One file | |
55 | table structure is used for each open, unshared, file descriptor. | |
56 | Multiple file descriptors may reference a single file table | |
57 | entry when they are created through a \fIdup\fP call, or as the | |
58 | result of a \fIfork\fP. This is defined to be | |
59 | .DS | |
60 | 16 * (NPROC + 16 + MAXUSERS) / 10 + 32 + 2 * NETSLOP | |
61 | .DE | |
62 | where NETSLOP is defined as for \fBntext\fP. | |
63 | .IP \fBncallout\fP | |
64 | .br | |
65 | The number of ``callout'' structures. One callout | |
66 | structure is used per internal system event handled with | |
67 | a timeout. Timeouts are used for terminal delays, | |
68 | watchdog routines in device drivers, protocol timeout processing, etc. | |
69 | This is defined as 16 + NPROC. | |
70 | .IP \fBnclist\fP | |
71 | .br | |
72 | The number of ``c-list'' structures. C-list structures are | |
73 | used in terminal i/o. This is defined as 100 + 16 * MAXUSERS. | |
74 | .IP \fBnmbclusters\fP | |
75 | .br | |
76 | The maximum number of pages which may be allocated by the network. | |
77 | This is defined as 256 (a quarter megabyte of memory) in /sys/h/mbuf.h. | |
78 | In practice, the network rarely uses this much memory. It starts off | |
79 | by allocating 64 kilobytes of memory, then requesting more as | |
80 | required. This value represents an upper bound. | |
81 | .IP \fBnquota\fP | |
82 | .br | |
83 | The number of ``quota'' structures allocated. Quota structures | |
84 | are present only when disc quotas are configured in the system. One | |
85 | quota structure is kept per user. This is defined to be | |
86 | (MAXUSERS * 9) / 7 + 3. | |
87 | .IP \fBndquot\fP | |
88 | .br | |
89 | The number of ``dquot'' structures allocated. Dquot structures | |
90 | are present only when disc quotas are configured in the system. | |
91 | One dquot structure is required per user, per active file system quota. | |
92 | That is, when a user manipulates a file on a file system on which | |
93 | quotas are enabled, the information regarding the user's quotas on | |
94 | that file system must be in-core. This information is cached, so | |
95 | that not all information must be present in-core all the time. | |
96 | This is defined as (MAXUSERS * NMOUNT) / 4 + NPROC, where NMOUNT | |
97 | is the maximum number of mountable file systems. | |
98 | .LP | |
99 | In addition to the above values, the system page tables (used to | |
100 | map virtual memory in the kernel's address space) are sized at | |
101 | compile time by the SYSPTSIZE definition in the file /sys/vax/param.h. | |
102 | This is defined to be 20 + MAXUSERS pages of page tables. | |
103 | Its definition affects | |
104 | the size of many data structures allocated at boot time because | |
105 | it constrains the amount of virtual memory which may be addressed | |
106 | by the running system. This is often the limiting factor | |
107 | in the size of the buffer cache. | |
108 | .SH | |
109 | Run-time calculations | |
110 | .PP | |
111 | The most important data structures sized at run-time are those used in | |
112 | the buffer cache. Allocation is done by swiping physical memory | |
113 | (and the associated virtual memory) immediately after the system | |
114 | has been started up; look in the file /sys/vax/machdep.c. | |
115 | The amount of physical memory which may be allocated to the buffer | |
116 | cache is constrained by the size of the system page tables, among | |
117 | other things. While the system may calculate | |
118 | a large amount of memory to be allocated to the buffer cache, | |
119 | if the system page | |
120 | table is too small to map this physical | |
121 | memory into the virtual address space | |
122 | of the system, only as much as can be mapped will be used. | |
123 | .PP | |
124 | The buffer cache is comprised of a number of ``buffer headers'' | |
125 | and a pool of pages attached to these headers. Buffer headers | |
126 | are divided into two categories: those used for swapping and | |
127 | paging, and those used for normal file i/o. The system tries | |
128 | to allocate 10% of available physical memory for the buffer | |
129 | cache (where \fIavailable\fP does not count that space occupied by | |
130 | the system's text and data segments). If this results in fewer | |
131 | than 16 pages of memory allocated, then 16 pages are allocated. | |
132 | This value is kept in the initialized variable \fIbufpages\fP | |
133 | so that it may be patched in the binary image (to allow tuning | |
134 | without recompiling the system). A sufficient number of | |
135 | file i/o buffer headers are then allocated to allow each to hold | |
136 | 2 pages each, and half as many swap i/o buffer headers are then | |
137 | allocated. The number of swap i/o buffer headers is constrained | |
138 | to be no more than 256. | |
139 | .SH | |
140 | System size limitations | |
141 | .PP | |
142 | As distributed, the sum of the virtual sizes of the core-resident | |
143 | processes is limited to 64M bytes. The size of the text, and data | |
144 | segments of a single process are currently limited to 6M bytes each, and | |
145 | the stack segment size is limited to 512K bytes as a soft, user-changeable | |
146 | limit, and may be increased to 6M with the \fIsetrlimit\fP\|(2) system call. | |
147 | If these are insufficient, they | |
148 | can be increased by changing the constants MAXTSIZ, MAXDSIZ and MAXSSIZ | |
149 | in the file | |
150 | /sys/vax/vmparam.h, while | |
151 | changing the definitions in | |
152 | /sys/h/dmap.h and /sys/h/text.h. | |
153 | You must be careful in doing this that you have adequate paging space. | |
154 | As normally configured , the system has only 16M bytes per paging area. | |
155 | The best way to get more space is to provide multiple, thereby | |
156 | interleaved, paging areas. | |
157 | .PP | |
158 | To increase the amount of resident virtual space possible, | |
159 | you can alter the constant USRPTSIZE (in | |
160 | /sys/vax/vmparam.h). | |
161 | To allow 128 megabytes of resident virtual space one would | |
162 | change the 8 to a 16. | |
163 | .PP | |
164 | Because the file system block numbers are stored in | |
165 | page table \fIpg_blkno\fP | |
166 | entries, the maximum size of a file system is limited to | |
167 | 2^19 1024 byte blocks. Thus no file system can be larger than 512M bytes. | |
168 | .PP | |
169 | The count of mountable file systems is limited to 15. This should | |
170 | be sufficient. If you have many disks it makes sense to make some of | |
171 | them single file systems, and the paging areas don't count in this total. | |
172 | To increase this it will be necessary to change the core-map | |
173 | /sys/h/cmap.h since there is a 4 bit field used here. The size | |
174 | of the core-map will then expand to 16 bytes per 1024 byte page. | |
175 | (Don't forget to change MSWAPX and NMOUNT in /sys/h/param.h also.) | |
176 | .PP | |
177 | The maximum value NOFILE (open files per process limit) | |
178 | can be raised to | |
179 | is 30 because of a bit field in the page table entry in | |
180 | /sys/machine/pte.h. |