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