~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/Documentation/sysctl/vm.txt

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 Documentation for /proc/sys/vm/*        kernel version 2.2.10
  2         (c) 1998, 1999,  Rik van Riel <riel@nl.linux.org>
  3 
  4 For general info and legal blurb, please look in README.
  5 
  6 ==============================================================
  7 
  8 This file contains the documentation for the sysctl files in
  9 /proc/sys/vm and is valid for Linux kernel version 2.2.
 10 
 11 The files in this directory can be used to tune the operation
 12 of the virtual memory (VM) subsystem of the Linux kernel, and
 13 one of the files (bdflush) also has a little influence on disk
 14 usage.
 15 
 16 Default values and initialization routines for most of these
 17 files can be found in mm/swap.c.
 18 
 19 Currently, these files are in /proc/sys/vm:
 20 - bdflush
 21 - buffermem
 22 - freepages
 23 - kswapd
 24 - overcommit_memory
 25 - page-cluster
 26 - pagecache
 27 - pagetable_cache
 28 
 29 ==============================================================
 30 
 31 bdflush:
 32 
 33 This file controls the operation of the bdflush kernel
 34 daemon. The source code to this struct can be found in
 35 linux/mm/buffer.c. It currently contains 9 integer values,
 36 of which 6 are actually used by the kernel.
 37 
 38 From linux/fs/buffer.c:
 39 --------------------------------------------------------------
 40 union bdflush_param{
 41     struct {
 42         int nfract;      /* Percentage of buffer cache dirty to
 43                             activate bdflush */
 44         int ndirty;      /* Maximum number of dirty blocks to
 45                             write out per wake-cycle */
 46         int nrefill;     /* Number of clean buffers to try to
 47                             obtain each time we call refill */
 48         int nref_dirt;   /* Dirty buffer threshold for activating
 49                             bdflush when trying to refill buffers. */
 50         int dummy1;      /* unused */
 51         int age_buffer;  /* Time for normal buffer to age before
 52                             we flush it */
 53         int age_super;   /* Time for superblock to age before we
 54                             flush it */
 55         int dummy2;      /* unused */
 56         int dummy3;      /* unused */
 57     } b_un;
 58     unsigned int data[N_PARAM];
 59 } bdf_prm = {{40, 500, 64, 256, 15, 30*HZ, 5*HZ, 1884, 2}};
 60 --------------------------------------------------------------
 61 
 62 The first parameter governs the maximum number of dirty
 63 buffers in the buffer cache. Dirty means that the contents
 64 of the buffer still have to be written to disk (as opposed
 65 to a clean buffer, which can just be forgotten about).
 66 Setting this to a high value means that Linux can delay disk
 67 writes for a long time, but it also means that it will have
 68 to do a lot of I/O at once when memory becomes short. A low
 69 value will spread out disk I/O more evenly.
 70 
 71 The second parameter (ndirty) gives the maximum number of
 72 dirty buffers that bdflush can write to the disk in one time.
 73 A high value will mean delayed, bursty I/O, while a small
 74 value can lead to memory shortage when bdflush isn't woken
 75 up often enough...
 76 
 77 The third parameter (nrefill) is the number of buffers that
 78 bdflush will add to the list of free buffers when
 79 refill_freelist() is called. It is necessary to allocate free
 80 buffers beforehand, since the buffers often are of a different
 81 size than memory pages and some bookkeeping needs to be done
 82 beforehand. The higher the number, the more memory will be
 83 wasted and the less often refill_freelist() will need to run.
 84 
 85 When refill_freelist() comes across more than nref_dirt dirty
 86 buffers, it will wake up bdflush.
 87 
 88 Finally, the age_buffer and age_super parameters govern the
 89 maximum time Linux waits before writing out a dirty buffer
 90 to disk. The value is expressed in jiffies (clockticks), the
 91 number of jiffies per second is 100, except on Alpha machines
 92 (1024). Age_buffer is the maximum age for data blocks, while
 93 age_super is for filesystem metadata.
 94 
 95 ==============================================================
 96 buffermem:
 97 
 98 The three values in this file correspond to the values in
 99 the struct buffer_mem. It controls how much memory should
100 be used for buffer memory. The percentage is calculated
101 as a percentage of total system memory.
102 
103 The values are:
104 min_percent     -- this is the minimum percentage of memory
105                    that should be spent on buffer memory
106 borrow_percent  -- UNUSED
107 max_percent     -- UNUSED
108 
109 ==============================================================
110 freepages:
111 
112 This file contains the values in the struct freepages. That
113 struct contains three members: min, low and high.
114 
115 The meaning of the numbers is:
116 
117 freepages.min   When the number of free pages in the system
118                 reaches this number, only the kernel can
119                 allocate more memory.
120 freepages.low   If the number of free pages gets below this
121                 point, the kernel starts swapping aggressively.
122 freepages.high  The kernel tries to keep up to this amount of
123                 memory free; if memory comes below this point,
124                 the kernel gently starts swapping in the hopes
125                 that it never has to do real aggressive swapping.
126 
127 ==============================================================
128 
129 kswapd:
130 
131 Kswapd is the kernel swapout daemon. That is, kswapd is that
132 piece of the kernel that frees memory when it gets fragmented
133 or full. Since every system is different, you'll probably want
134 some control over this piece of the system.
135 
136 The numbers in this page correspond to the numbers in the
137 struct pager_daemon {tries_base, tries_min, swap_cluster
138 }; The tries_base and swap_cluster probably have the
139 largest influence on system performance.
140 
141 tries_base      The maximum number of pages kswapd tries to
142                 free in one round is calculated from this
143                 number. Usually this number will be divided
144                 by 4 or 8 (see mm/vmscan.c), so it isn't as
145                 big as it looks.
146                 When you need to increase the bandwidth to/from
147                 swap, you'll want to increase this number.
148 tries_min       This is the minimum number of times kswapd
149                 tries to free a page each time it is called.
150                 Basically it's just there to make sure that
151                 kswapd frees some pages even when it's being
152                 called with minimum priority.
153 swap_cluster    This is the number of pages kswapd writes in
154                 one turn. You want this large so that kswapd
155                 does it's I/O in large chunks and the disk
156                 doesn't have to seek often, but you don't want
157                 it to be too large since that would flood the
158                 request queue.
159 
160 ==============================================================
161 
162 overcommit_memory:
163 
164 This value contains a flag that enables memory overcommitment.
165 When this flag is 0, the kernel checks before each malloc()
166 to see if there's enough memory left. If the flag is nonzero,
167 the system pretends there's always enough memory.
168 
169 This feature can be very useful because there are a lot of
170 programs that malloc() huge amounts of memory "just-in-case"
171 and don't use much of it.
172 
173 Look at: mm/mmap.c::vm_enough_memory() for more information.
174 
175 ==============================================================
176 
177 page-cluster:
178 
179 The Linux VM subsystem avoids excessive disk seeks by reading
180 multiple pages on a page fault. The number of pages it reads
181 is dependent on the amount of memory in your machine.
182 
183 The number of pages the kernel reads in at once is equal to
184 2 ^ page-cluster. Values above 2 ^ 5 don't make much sense
185 for swap because we only cluster swap data in 32-page groups.
186 
187 ==============================================================
188 
189 pagecache:
190 
191 This file does exactly the same as buffermem, only this
192 file controls the struct page_cache, and thus controls
193 the amount of memory used for the page cache.
194 
195 In 2.2, the page cache is used for 3 main purposes:
196 - caching read() data from files
197 - caching mmap()ed data and executable files
198 - swap cache
199 
200 When your system is both deep in swap and high on cache,
201 it probably means that a lot of the swapped data is being
202 cached, making for more efficient swapping than possible
203 with the 2.0 kernel.
204 
205 ==============================================================
206 
207 pagetable_cache:
208 
209 The kernel keeps a number of page tables in a per-processor
210 cache (this helps a lot on SMP systems). The cache size for
211 each processor will be between the low and the high value.
212 
213 On a low-memory, single CPU system you can safely set these
214 values to 0 so you don't waste the memory. On SMP systems it
215 is used so that the system can do fast pagetable allocations
216 without having to acquire the kernel memory lock.
217 
218 For large systems, the settings are probably OK. For normal
219 systems they won't hurt a bit. For small systems (<16MB ram)
220 it might be advantageous to set both values to 0.
221 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.