Merge branch 'next' into for-linus
[sfrench/cifs-2.6.git] / Documentation / sysctl / vm.txt
1 Documentation for /proc/sys/vm/*        kernel version 2.6.29
2         (c) 1998, 1999,  Rik van Riel <riel@nl.linux.org>
3         (c) 2008         Peter W. Morreale <pmorreale@novell.com>
4
5 For general info and legal blurb, please look in README.
6
7 ==============================================================
8
9 This file contains the documentation for the sysctl files in
10 /proc/sys/vm and is valid for Linux kernel version 2.6.29.
11
12 The files in this directory can be used to tune the operation
13 of the virtual memory (VM) subsystem of the Linux kernel and
14 the writeout of dirty data to disk.
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
21 - block_dump
22 - dirty_background_bytes
23 - dirty_background_ratio
24 - dirty_bytes
25 - dirty_expire_centisecs
26 - dirty_ratio
27 - dirty_writeback_centisecs
28 - drop_caches
29 - hugepages_treat_as_movable
30 - hugetlb_shm_group
31 - laptop_mode
32 - legacy_va_layout
33 - lowmem_reserve_ratio
34 - max_map_count
35 - min_free_kbytes
36 - min_slab_ratio
37 - min_unmapped_ratio
38 - mmap_min_addr
39 - nr_hugepages
40 - nr_overcommit_hugepages
41 - nr_pdflush_threads
42 - nr_pdflush_threads_min
43 - nr_pdflush_threads_max
44 - nr_trim_pages         (only if CONFIG_MMU=n)
45 - numa_zonelist_order
46 - oom_dump_tasks
47 - oom_kill_allocating_task
48 - overcommit_memory
49 - overcommit_ratio
50 - page-cluster
51 - panic_on_oom
52 - percpu_pagelist_fraction
53 - stat_interval
54 - swappiness
55 - vfs_cache_pressure
56 - zone_reclaim_mode
57
58
59 ==============================================================
60
61 block_dump
62
63 block_dump enables block I/O debugging when set to a nonzero value. More
64 information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
65
66 ==============================================================
67
68 dirty_background_bytes
69
70 Contains the amount of dirty memory at which the pdflush background writeback
71 daemon will start writeback.
72
73 If dirty_background_bytes is written, dirty_background_ratio becomes a function
74 of its value (dirty_background_bytes / the amount of dirtyable system memory).
75
76 ==============================================================
77
78 dirty_background_ratio
79
80 Contains, as a percentage of total system memory, the number of pages at which
81 the pdflush background writeback daemon will start writing out dirty data.
82
83 ==============================================================
84
85 dirty_bytes
86
87 Contains the amount of dirty memory at which a process generating disk writes
88 will itself start writeback.
89
90 If dirty_bytes is written, dirty_ratio becomes a function of its value
91 (dirty_bytes / the amount of dirtyable system memory).
92
93 ==============================================================
94
95 dirty_expire_centisecs
96
97 This tunable is used to define when dirty data is old enough to be eligible
98 for writeout by the pdflush daemons.  It is expressed in 100'ths of a second.
99 Data which has been dirty in-memory for longer than this interval will be
100 written out next time a pdflush daemon wakes up.
101
102 ==============================================================
103
104 dirty_ratio
105
106 Contains, as a percentage of total system memory, the number of pages at which
107 a process which is generating disk writes will itself start writing out dirty
108 data.
109
110 ==============================================================
111
112 dirty_writeback_centisecs
113
114 The pdflush writeback daemons will periodically wake up and write `old' data
115 out to disk.  This tunable expresses the interval between those wakeups, in
116 100'ths of a second.
117
118 Setting this to zero disables periodic writeback altogether.
119
120 ==============================================================
121
122 drop_caches
123
124 Writing to this will cause the kernel to drop clean caches, dentries and
125 inodes from memory, causing that memory to become free.
126
127 To free pagecache:
128         echo 1 > /proc/sys/vm/drop_caches
129 To free dentries and inodes:
130         echo 2 > /proc/sys/vm/drop_caches
131 To free pagecache, dentries and inodes:
132         echo 3 > /proc/sys/vm/drop_caches
133
134 As this is a non-destructive operation and dirty objects are not freeable, the
135 user should run `sync' first.
136
137 ==============================================================
138
139 hugepages_treat_as_movable
140
141 This parameter is only useful when kernelcore= is specified at boot time to
142 create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages
143 are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero
144 value written to hugepages_treat_as_movable allows huge pages to be allocated
145 from ZONE_MOVABLE.
146
147 Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge
148 pages pool can easily grow or shrink within. Assuming that applications are
149 not running that mlock() a lot of memory, it is likely the huge pages pool
150 can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value
151 into nr_hugepages and triggering page reclaim.
152
153 ==============================================================
154
155 hugetlb_shm_group
156
157 hugetlb_shm_group contains group id that is allowed to create SysV
158 shared memory segment using hugetlb page.
159
160 ==============================================================
161
162 laptop_mode
163
164 laptop_mode is a knob that controls "laptop mode". All the things that are
165 controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
166
167 ==============================================================
168
169 legacy_va_layout
170
171 If non-zero, this sysctl disables the new 32-bit mmap mmap layout - the kernel
172 will use the legacy (2.4) layout for all processes.
173
174 ==============================================================
175
176 lowmem_reserve_ratio
177
178 For some specialised workloads on highmem machines it is dangerous for
179 the kernel to allow process memory to be allocated from the "lowmem"
180 zone.  This is because that memory could then be pinned via the mlock()
181 system call, or by unavailability of swapspace.
182
183 And on large highmem machines this lack of reclaimable lowmem memory
184 can be fatal.
185
186 So the Linux page allocator has a mechanism which prevents allocations
187 which _could_ use highmem from using too much lowmem.  This means that
188 a certain amount of lowmem is defended from the possibility of being
189 captured into pinned user memory.
190
191 (The same argument applies to the old 16 megabyte ISA DMA region.  This
192 mechanism will also defend that region from allocations which could use
193 highmem or lowmem).
194
195 The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
196 in defending these lower zones.
197
198 If you have a machine which uses highmem or ISA DMA and your
199 applications are using mlock(), or if you are running with no swap then
200 you probably should change the lowmem_reserve_ratio setting.
201
202 The lowmem_reserve_ratio is an array. You can see them by reading this file.
203 -
204 % cat /proc/sys/vm/lowmem_reserve_ratio
205 256     256     32
206 -
207 Note: # of this elements is one fewer than number of zones. Because the highest
208       zone's value is not necessary for following calculation.
209
210 But, these values are not used directly. The kernel calculates # of protection
211 pages for each zones from them. These are shown as array of protection pages
212 in /proc/zoneinfo like followings. (This is an example of x86-64 box).
213 Each zone has an array of protection pages like this.
214
215 -
216 Node 0, zone      DMA
217   pages free     1355
218         min      3
219         low      3
220         high     4
221         :
222         :
223     numa_other   0
224         protection: (0, 2004, 2004, 2004)
225         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
226   pagesets
227     cpu: 0 pcp: 0
228         :
229 -
230 These protections are added to score to judge whether this zone should be used
231 for page allocation or should be reclaimed.
232
233 In this example, if normal pages (index=2) are required to this DMA zone and
234 pages_high is used for watermark, the kernel judges this zone should not be
235 used because pages_free(1355) is smaller than watermark + protection[2]
236 (4 + 2004 = 2008). If this protection value is 0, this zone would be used for
237 normal page requirement. If requirement is DMA zone(index=0), protection[0]
238 (=0) is used.
239
240 zone[i]'s protection[j] is calculated by following expression.
241
242 (i < j):
243   zone[i]->protection[j]
244   = (total sums of present_pages from zone[i+1] to zone[j] on the node)
245     / lowmem_reserve_ratio[i];
246 (i = j):
247    (should not be protected. = 0;
248 (i > j):
249    (not necessary, but looks 0)
250
251 The default values of lowmem_reserve_ratio[i] are
252     256 (if zone[i] means DMA or DMA32 zone)
253     32  (others).
254 As above expression, they are reciprocal number of ratio.
255 256 means 1/256. # of protection pages becomes about "0.39%" of total present
256 pages of higher zones on the node.
257
258 If you would like to protect more pages, smaller values are effective.
259 The minimum value is 1 (1/1 -> 100%).
260
261 ==============================================================
262
263 max_map_count:
264
265 This file contains the maximum number of memory map areas a process
266 may have. Memory map areas are used as a side-effect of calling
267 malloc, directly by mmap and mprotect, and also when loading shared
268 libraries.
269
270 While most applications need less than a thousand maps, certain
271 programs, particularly malloc debuggers, may consume lots of them,
272 e.g., up to one or two maps per allocation.
273
274 The default value is 65536.
275
276 ==============================================================
277
278 min_free_kbytes:
279
280 This is used to force the Linux VM to keep a minimum number
281 of kilobytes free.  The VM uses this number to compute a pages_min
282 value for each lowmem zone in the system.  Each lowmem zone gets
283 a number of reserved free pages based proportionally on its size.
284
285 Some minimal amount of memory is needed to satisfy PF_MEMALLOC
286 allocations; if you set this to lower than 1024KB, your system will
287 become subtly broken, and prone to deadlock under high loads.
288
289 Setting this too high will OOM your machine instantly.
290
291 =============================================================
292
293 min_slab_ratio:
294
295 This is available only on NUMA kernels.
296
297 A percentage of the total pages in each zone.  On Zone reclaim
298 (fallback from the local zone occurs) slabs will be reclaimed if more
299 than this percentage of pages in a zone are reclaimable slab pages.
300 This insures that the slab growth stays under control even in NUMA
301 systems that rarely perform global reclaim.
302
303 The default is 5 percent.
304
305 Note that slab reclaim is triggered in a per zone / node fashion.
306 The process of reclaiming slab memory is currently not node specific
307 and may not be fast.
308
309 =============================================================
310
311 min_unmapped_ratio:
312
313 This is available only on NUMA kernels.
314
315 A percentage of the total pages in each zone.  Zone reclaim will only
316 occur if more than this percentage of pages are file backed and unmapped.
317 This is to insure that a minimal amount of local pages is still available for
318 file I/O even if the node is overallocated.
319
320 The default is 1 percent.
321
322 ==============================================================
323
324 mmap_min_addr
325
326 This file indicates the amount of address space  which a user process will
327 be restricted from mmaping.  Since kernel null dereference bugs could
328 accidentally operate based on the information in the first couple of pages
329 of memory userspace processes should not be allowed to write to them.  By
330 default this value is set to 0 and no protections will be enforced by the
331 security module.  Setting this value to something like 64k will allow the
332 vast majority of applications to work correctly and provide defense in depth
333 against future potential kernel bugs.
334
335 ==============================================================
336
337 nr_hugepages
338
339 Change the minimum size of the hugepage pool.
340
341 See Documentation/vm/hugetlbpage.txt
342
343 ==============================================================
344
345 nr_overcommit_hugepages
346
347 Change the maximum size of the hugepage pool. The maximum is
348 nr_hugepages + nr_overcommit_hugepages.
349
350 See Documentation/vm/hugetlbpage.txt
351
352 ==============================================================
353
354 nr_pdflush_threads
355
356 The current number of pdflush threads.  This value is read-only.
357 The value changes according to the number of dirty pages in the system.
358
359 When neccessary, additional pdflush threads are created, one per second, up to
360 nr_pdflush_threads_max.
361
362 ==============================================================
363
364 nr_trim_pages
365
366 This is available only on NOMMU kernels.
367
368 This value adjusts the excess page trimming behaviour of power-of-2 aligned
369 NOMMU mmap allocations.
370
371 A value of 0 disables trimming of allocations entirely, while a value of 1
372 trims excess pages aggressively. Any value >= 1 acts as the watermark where
373 trimming of allocations is initiated.
374
375 The default value is 1.
376
377 See Documentation/nommu-mmap.txt for more information.
378
379 ==============================================================
380
381 numa_zonelist_order
382
383 This sysctl is only for NUMA.
384 'where the memory is allocated from' is controlled by zonelists.
385 (This documentation ignores ZONE_HIGHMEM/ZONE_DMA32 for simple explanation.
386  you may be able to read ZONE_DMA as ZONE_DMA32...)
387
388 In non-NUMA case, a zonelist for GFP_KERNEL is ordered as following.
389 ZONE_NORMAL -> ZONE_DMA
390 This means that a memory allocation request for GFP_KERNEL will
391 get memory from ZONE_DMA only when ZONE_NORMAL is not available.
392
393 In NUMA case, you can think of following 2 types of order.
394 Assume 2 node NUMA and below is zonelist of Node(0)'s GFP_KERNEL
395
396 (A) Node(0) ZONE_NORMAL -> Node(0) ZONE_DMA -> Node(1) ZONE_NORMAL
397 (B) Node(0) ZONE_NORMAL -> Node(1) ZONE_NORMAL -> Node(0) ZONE_DMA.
398
399 Type(A) offers the best locality for processes on Node(0), but ZONE_DMA
400 will be used before ZONE_NORMAL exhaustion. This increases possibility of
401 out-of-memory(OOM) of ZONE_DMA because ZONE_DMA is tend to be small.
402
403 Type(B) cannot offer the best locality but is more robust against OOM of
404 the DMA zone.
405
406 Type(A) is called as "Node" order. Type (B) is "Zone" order.
407
408 "Node order" orders the zonelists by node, then by zone within each node.
409 Specify "[Nn]ode" for zone order
410
411 "Zone Order" orders the zonelists by zone type, then by node within each
412 zone.  Specify "[Zz]one"for zode order.
413
414 Specify "[Dd]efault" to request automatic configuration.  Autoconfiguration
415 will select "node" order in following case.
416 (1) if the DMA zone does not exist or
417 (2) if the DMA zone comprises greater than 50% of the available memory or
418 (3) if any node's DMA zone comprises greater than 60% of its local memory and
419     the amount of local memory is big enough.
420
421 Otherwise, "zone" order will be selected. Default order is recommended unless
422 this is causing problems for your system/application.
423
424 ==============================================================
425
426 oom_dump_tasks
427
428 Enables a system-wide task dump (excluding kernel threads) to be
429 produced when the kernel performs an OOM-killing and includes such
430 information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and
431 name.  This is helpful to determine why the OOM killer was invoked
432 and to identify the rogue task that caused it.
433
434 If this is set to zero, this information is suppressed.  On very
435 large systems with thousands of tasks it may not be feasible to dump
436 the memory state information for each one.  Such systems should not
437 be forced to incur a performance penalty in OOM conditions when the
438 information may not be desired.
439
440 If this is set to non-zero, this information is shown whenever the
441 OOM killer actually kills a memory-hogging task.
442
443 The default value is 0.
444
445 ==============================================================
446
447 oom_kill_allocating_task
448
449 This enables or disables killing the OOM-triggering task in
450 out-of-memory situations.
451
452 If this is set to zero, the OOM killer will scan through the entire
453 tasklist and select a task based on heuristics to kill.  This normally
454 selects a rogue memory-hogging task that frees up a large amount of
455 memory when killed.
456
457 If this is set to non-zero, the OOM killer simply kills the task that
458 triggered the out-of-memory condition.  This avoids the expensive
459 tasklist scan.
460
461 If panic_on_oom is selected, it takes precedence over whatever value
462 is used in oom_kill_allocating_task.
463
464 The default value is 0.
465
466 ==============================================================
467
468 nr_pdflush_threads_min
469
470 This value controls the minimum number of pdflush threads.
471
472 At boot time, the kernel will create and maintain 'nr_pdflush_threads_min'
473 threads for the kernel's lifetime.
474
475 The default value is 2.  The minimum value you can specify is 1, and
476 the maximum value is the current setting of 'nr_pdflush_threads_max'.
477
478 See 'nr_pdflush_threads_max' below for more information.
479
480 ==============================================================
481
482 nr_pdflush_threads_max
483
484 This value controls the maximum number of pdflush threads that can be
485 created.  The pdflush algorithm will create a new pdflush thread (up to
486 this maximum) if no pdflush threads have been available for >= 1 second.
487
488 The default value is 8.  The minimum value you can specify is the
489 current value of 'nr_pdflush_threads_min' and the
490 maximum is 1000.
491
492 ==============================================================
493
494 overcommit_memory:
495
496 This value contains a flag that enables memory overcommitment.
497
498 When this flag is 0, the kernel attempts to estimate the amount
499 of free memory left when userspace requests more memory.
500
501 When this flag is 1, the kernel pretends there is always enough
502 memory until it actually runs out.
503
504 When this flag is 2, the kernel uses a "never overcommit"
505 policy that attempts to prevent any overcommit of memory.
506
507 This feature can be very useful because there are a lot of
508 programs that malloc() huge amounts of memory "just-in-case"
509 and don't use much of it.
510
511 The default value is 0.
512
513 See Documentation/vm/overcommit-accounting and
514 security/commoncap.c::cap_vm_enough_memory() for more information.
515
516 ==============================================================
517
518 overcommit_ratio:
519
520 When overcommit_memory is set to 2, the committed address
521 space is not permitted to exceed swap plus this percentage
522 of physical RAM.  See above.
523
524 ==============================================================
525
526 page-cluster
527
528 page-cluster controls the number of pages which are written to swap in
529 a single attempt.  The swap I/O size.
530
531 It is a logarithmic value - setting it to zero means "1 page", setting
532 it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
533
534 The default value is three (eight pages at a time).  There may be some
535 small benefits in tuning this to a different value if your workload is
536 swap-intensive.
537
538 =============================================================
539
540 panic_on_oom
541
542 This enables or disables panic on out-of-memory feature.
543
544 If this is set to 0, the kernel will kill some rogue process,
545 called oom_killer.  Usually, oom_killer can kill rogue processes and
546 system will survive.
547
548 If this is set to 1, the kernel panics when out-of-memory happens.
549 However, if a process limits using nodes by mempolicy/cpusets,
550 and those nodes become memory exhaustion status, one process
551 may be killed by oom-killer. No panic occurs in this case.
552 Because other nodes' memory may be free. This means system total status
553 may be not fatal yet.
554
555 If this is set to 2, the kernel panics compulsorily even on the
556 above-mentioned.
557
558 The default value is 0.
559 1 and 2 are for failover of clustering. Please select either
560 according to your policy of failover.
561
562 =============================================================
563
564 percpu_pagelist_fraction
565
566 This is the fraction of pages at most (high mark pcp->high) in each zone that
567 are allocated for each per cpu page list.  The min value for this is 8.  It
568 means that we don't allow more than 1/8th of pages in each zone to be
569 allocated in any single per_cpu_pagelist.  This entry only changes the value
570 of hot per cpu pagelists.  User can specify a number like 100 to allocate
571 1/100th of each zone to each per cpu page list.
572
573 The batch value of each per cpu pagelist is also updated as a result.  It is
574 set to pcp->high/4.  The upper limit of batch is (PAGE_SHIFT * 8)
575
576 The initial value is zero.  Kernel does not use this value at boot time to set
577 the high water marks for each per cpu page list.
578
579 ==============================================================
580
581 stat_interval
582
583 The time interval between which vm statistics are updated.  The default
584 is 1 second.
585
586 ==============================================================
587
588 swappiness
589
590 This control is used to define how aggressive the kernel will swap
591 memory pages.  Higher values will increase agressiveness, lower values
592 descrease the amount of swap.
593
594 The default value is 60.
595
596 ==============================================================
597
598 vfs_cache_pressure
599 ------------------
600
601 Controls the tendency of the kernel to reclaim the memory which is used for
602 caching of directory and inode objects.
603
604 At the default value of vfs_cache_pressure=100 the kernel will attempt to
605 reclaim dentries and inodes at a "fair" rate with respect to pagecache and
606 swapcache reclaim.  Decreasing vfs_cache_pressure causes the kernel to prefer
607 to retain dentry and inode caches.  Increasing vfs_cache_pressure beyond 100
608 causes the kernel to prefer to reclaim dentries and inodes.
609
610 ==============================================================
611
612 zone_reclaim_mode:
613
614 Zone_reclaim_mode allows someone to set more or less aggressive approaches to
615 reclaim memory when a zone runs out of memory. If it is set to zero then no
616 zone reclaim occurs. Allocations will be satisfied from other zones / nodes
617 in the system.
618
619 This is value ORed together of
620
621 1       = Zone reclaim on
622 2       = Zone reclaim writes dirty pages out
623 4       = Zone reclaim swaps pages
624
625 zone_reclaim_mode is set during bootup to 1 if it is determined that pages
626 from remote zones will cause a measurable performance reduction. The
627 page allocator will then reclaim easily reusable pages (those page
628 cache pages that are currently not used) before allocating off node pages.
629
630 It may be beneficial to switch off zone reclaim if the system is
631 used for a file server and all of memory should be used for caching files
632 from disk. In that case the caching effect is more important than
633 data locality.
634
635 Allowing zone reclaim to write out pages stops processes that are
636 writing large amounts of data from dirtying pages on other nodes. Zone
637 reclaim will write out dirty pages if a zone fills up and so effectively
638 throttle the process. This may decrease the performance of a single process
639 since it cannot use all of system memory to buffer the outgoing writes
640 anymore but it preserve the memory on other nodes so that the performance
641 of other processes running on other nodes will not be affected.
642
643 Allowing regular swap effectively restricts allocations to the local
644 node unless explicitly overridden by memory policies or cpuset
645 configurations.
646
647 ============ End of Document =================================