1===============================
2Documentation for /proc/sys/vm/
3===============================
4
5kernel version 2.6.29
6
7Copyright (c) 1998, 1999,  Rik van Riel <[email protected]>
8
9Copyright (c) 2008         Peter W. Morreale <[email protected]>
10
11For general info and legal blurb, please look in index.rst.
12
13------------------------------------------------------------------------------
14
15This file contains the documentation for the sysctl files in
16/proc/sys/vm and is valid for Linux kernel version 2.6.29.
17
18The files in this directory can be used to tune the operation
19of the virtual memory (VM) subsystem of the Linux kernel and
20the writeout of dirty data to disk.
21
22Default values and initialization routines for most of these
23files can be found in mm/swap.c.
24
25Currently, these files are in /proc/sys/vm:
26
27- admin_reserve_kbytes
28- block_dump
29- compact_memory
30- compaction_proactiveness
31- compact_unevictable_allowed
32- dirty_background_bytes
33- dirty_background_ratio
34- dirty_bytes
35- dirty_expire_centisecs
36- dirty_ratio
37- dirtytime_expire_seconds
38- dirty_writeback_centisecs
39- drop_caches
40- extfrag_threshold
41- highmem_is_dirtyable
42- hugetlb_shm_group
43- laptop_mode
44- legacy_va_layout
45- lowmem_reserve_ratio
46- max_map_count
47- memory_failure_early_kill
48- memory_failure_recovery
49- min_free_kbytes
50- min_slab_ratio
51- min_unmapped_ratio
52- mmap_min_addr
53- mmap_rnd_bits
54- mmap_rnd_compat_bits
55- nr_hugepages
56- nr_hugepages_mempolicy
57- nr_overcommit_hugepages
58- nr_trim_pages         (only if CONFIG_MMU=n)
59- numa_zonelist_order
60- oom_dump_tasks
61- oom_kill_allocating_task
62- overcommit_kbytes
63- overcommit_memory
64- overcommit_ratio
65- page-cluster
66- panic_on_oom
67- stat_interval
68- stat_refresh
69- numa_stat
70- swappiness
71- unprivileged_userfaultfd
72- user_reserve_kbytes
73- vfs_cache_pressure
74- watermark_boost_factor
75- watermark_scale_factor
76- zone_reclaim_mode
77
78
79admin_reserve_kbytes
80====================
81
82The amount of free memory in the system that should be reserved for users
83with the capability cap_sys_admin.
84
85admin_reserve_kbytes defaults to min(3% of free pages, 8MB)
86
87That should provide enough for the admin to log in and kill a process,
88if necessary, under the default overcommit 'guess' mode.
89
90Systems running under overcommit 'never' should increase this to account
91for the full Virtual Memory Size of programs used to recover. Otherwise,
92root may not be able to log in to recover the system.
93
94How do you calculate a minimum useful reserve?
95
96sshd or login + bash (or some other shell) + top (or ps, kill, etc.)
97
98For overcommit 'guess', we can sum resident set sizes (RSS).
99On x86_64 this is about 8MB.
100
101For overcommit 'never', we can take the max of their virtual sizes (VSZ)
102and add the sum of their RSS.
103On x86_64 this is about 128MB.
104
105Changing this takes effect whenever an application requests memory.
106
107
108block_dump
109==========
110
111block_dump enables block I/O debugging when set to a nonzero value. More
112information on block I/O debugging is in Documentation/admin-guide/laptops/laptop-mode.rst.
113
114
115compact_memory
116==============
117
118Available only when CONFIG_COMPACTION is set. When 1 is written to the file,
119all zones are compacted such that free memory is available in contiguous
120blocks where possible. This can be important for example in the allocation of
121huge pages although processes will also directly compact memory as required.
122
123compaction_proactiveness
124========================
125
126This tunable takes a value in the range [0, 100] with a default value of
12720. This tunable determines how aggressively compaction is done in the
128background. Setting it to 0 disables proactive compaction.
129
130Note that compaction has a non-trivial system-wide impact as pages
131belonging to different processes are moved around, which could also lead
132to latency spikes in unsuspecting applications. The kernel employs
133various heuristics to avoid wasting CPU cycles if it detects that
134proactive compaction is not being effective.
135
136Be careful when setting it to extreme values like 100, as that may
137cause excessive background compaction activity.
138
139compact_unevictable_allowed
140===========================
141
142Available only when CONFIG_COMPACTION is set. When set to 1, compaction is
143allowed to examine the unevictable lru (mlocked pages) for pages to compact.
144This should be used on systems where stalls for minor page faults are an
145acceptable trade for large contiguous free memory.  Set to 0 to prevent
146compaction from moving pages that are unevictable.  Default value is 1.
147On CONFIG_PREEMPT_RT the default value is 0 in order to avoid a page fault, due
148to compaction, which would block the task from becoming active until the fault
149is resolved.
150
151
152dirty_background_bytes
153======================
154
155Contains the amount of dirty memory at which the background kernel
156flusher threads will start writeback.
157
158Note:
159  dirty_background_bytes is the counterpart of dirty_background_ratio. Only
160  one of them may be specified at a time. When one sysctl is written it is
161  immediately taken into account to evaluate the dirty memory limits and the
162  other appears as 0 when read.
163
164
165dirty_background_ratio
166======================
167
168Contains, as a percentage of total available memory that contains free pages
169and reclaimable pages, the number of pages at which the background kernel
170flusher threads will start writing out dirty data.
171
172The total available memory is not equal to total system memory.
173
174
175dirty_bytes
176===========
177
178Contains the amount of dirty memory at which a process generating disk writes
179will itself start writeback.
180
181Note: dirty_bytes is the counterpart of dirty_ratio. Only one of them may be
182specified at a time. When one sysctl is written it is immediately taken into
183account to evaluate the dirty memory limits and the other appears as 0 when
184read.
185
186Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any
187value lower than this limit will be ignored and the old configuration will be
188retained.
189
190
191dirty_expire_centisecs
192======================
193
194This tunable is used to define when dirty data is old enough to be eligible
195for writeout by the kernel flusher threads.  It is expressed in 100'ths
196of a second.  Data which has been dirty in-memory for longer than this
197interval will be written out next time a flusher thread wakes up.
198
199
200dirty_ratio
201===========
202
203Contains, as a percentage of total available memory that contains free pages
204and reclaimable pages, the number of pages at which a process which is
205generating disk writes will itself start writing out dirty data.
206
207The total available memory is not equal to total system memory.
208
209
210dirtytime_expire_seconds
211========================
212
213When a lazytime inode is constantly having its pages dirtied, the inode with
214an updated timestamp will never get chance to be written out.  And, if the
215only thing that has happened on the file system is a dirtytime inode caused
216by an atime update, a worker will be scheduled to make sure that inode
217eventually gets pushed out to disk.  This tunable is used to define when dirty
218inode is old enough to be eligible for writeback by the kernel flusher threads.
219And, it is also used as the interval to wakeup dirtytime_writeback thread.
220
221
222dirty_writeback_centisecs
223=========================
224
225The kernel flusher threads will periodically wake up and write `old` data
226out to disk.  This tunable expresses the interval between those wakeups, in
227100'ths of a second.
228
229Setting this to zero disables periodic writeback altogether.
230
231
232drop_caches
233===========
234
235Writing to this will cause the kernel to drop clean caches, as well as
236reclaimable slab objects like dentries and inodes.  Once dropped, their
237memory becomes free.
238
239To free pagecache::
240
241	echo 1 > /proc/sys/vm/drop_caches
242
243To free reclaimable slab objects (includes dentries and inodes)::
244
245	echo 2 > /proc/sys/vm/drop_caches
246
247To free slab objects and pagecache::
248
249	echo 3 > /proc/sys/vm/drop_caches
250
251This is a non-destructive operation and will not free any dirty objects.
252To increase the number of objects freed by this operation, the user may run
253`sync` prior to writing to /proc/sys/vm/drop_caches.  This will minimize the
254number of dirty objects on the system and create more candidates to be
255dropped.
256
257This file is not a means to control the growth of the various kernel caches
258(inodes, dentries, pagecache, etc...)  These objects are automatically
259reclaimed by the kernel when memory is needed elsewhere on the system.
260
261Use of this file can cause performance problems.  Since it discards cached
262objects, it may cost a significant amount of I/O and CPU to recreate the
263dropped objects, especially if they were under heavy use.  Because of this,
264use outside of a testing or debugging environment is not recommended.
265
266You may see informational messages in your kernel log when this file is
267used::
268
269	cat (1234): drop_caches: 3
270
271These are informational only.  They do not mean that anything is wrong
272with your system.  To disable them, echo 4 (bit 2) into drop_caches.
273
274
275extfrag_threshold
276=================
277
278This parameter affects whether the kernel will compact memory or direct
279reclaim to satisfy a high-order allocation. The extfrag/extfrag_index file in
280debugfs shows what the fragmentation index for each order is in each zone in
281the system. Values tending towards 0 imply allocations would fail due to lack
282of memory, values towards 1000 imply failures are due to fragmentation and -1
283implies that the allocation will succeed as long as watermarks are met.
284
285The kernel will not compact memory in a zone if the
286fragmentation index is <= extfrag_threshold. The default value is 500.
287
288
289highmem_is_dirtyable
290====================
291
292Available only for systems with CONFIG_HIGHMEM enabled (32b systems).
293
294This parameter controls whether the high memory is considered for dirty
295writers throttling.  This is not the case by default which means that
296only the amount of memory directly visible/usable by the kernel can
297be dirtied. As a result, on systems with a large amount of memory and
298lowmem basically depleted writers might be throttled too early and
299streaming writes can get very slow.
300
301Changing the value to non zero would allow more memory to be dirtied
302and thus allow writers to write more data which can be flushed to the
303storage more effectively. Note this also comes with a risk of pre-mature
304OOM killer because some writers (e.g. direct block device writes) can
305only use the low memory and they can fill it up with dirty data without
306any throttling.
307
308
309hugetlb_shm_group
310=================
311
312hugetlb_shm_group contains group id that is allowed to create SysV
313shared memory segment using hugetlb page.
314
315
316laptop_mode
317===========
318
319laptop_mode is a knob that controls "laptop mode". All the things that are
320controlled by this knob are discussed in Documentation/admin-guide/laptops/laptop-mode.rst.
321
322
323legacy_va_layout
324================
325
326If non-zero, this sysctl disables the new 32-bit mmap layout - the kernel
327will use the legacy (2.4) layout for all processes.
328
329
330lowmem_reserve_ratio
331====================
332
333For some specialised workloads on highmem machines it is dangerous for
334the kernel to allow process memory to be allocated from the "lowmem"
335zone.  This is because that memory could then be pinned via the mlock()
336system call, or by unavailability of swapspace.
337
338And on large highmem machines this lack of reclaimable lowmem memory
339can be fatal.
340
341So the Linux page allocator has a mechanism which prevents allocations
342which *could* use highmem from using too much lowmem.  This means that
343a certain amount of lowmem is defended from the possibility of being
344captured into pinned user memory.
345
346(The same argument applies to the old 16 megabyte ISA DMA region.  This
347mechanism will also defend that region from allocations which could use
348highmem or lowmem).
349
350The `lowmem_reserve_ratio` tunable determines how aggressive the kernel is
351in defending these lower zones.
352
353If you have a machine which uses highmem or ISA DMA and your
354applications are using mlock(), or if you are running with no swap then
355you probably should change the lowmem_reserve_ratio setting.
356
357The lowmem_reserve_ratio is an array. You can see them by reading this file::
358
359	% cat /proc/sys/vm/lowmem_reserve_ratio
360	256     256     32
361
362But, these values are not used directly. The kernel calculates # of protection
363pages for each zones from them. These are shown as array of protection pages
364in /proc/zoneinfo like followings. (This is an example of x86-64 box).
365Each zone has an array of protection pages like this::
366
367  Node 0, zone      DMA
368    pages free     1355
369          min      3
370          low      3
371          high     4
372	:
373	:
374      numa_other   0
375          protection: (0, 2004, 2004, 2004)
376	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
377    pagesets
378      cpu: 0 pcp: 0
379          :
380
381These protections are added to score to judge whether this zone should be used
382for page allocation or should be reclaimed.
383
384In this example, if normal pages (index=2) are required to this DMA zone and
385watermark[WMARK_HIGH] is used for watermark, the kernel judges this zone should
386not be used because pages_free(1355) is smaller than watermark + protection[2]
387(4 + 2004 = 2008). If this protection value is 0, this zone would be used for
388normal page requirement. If requirement is DMA zone(index=0), protection[0]
389(=0) is used.
390
391zone[i]'s protection[j] is calculated by following expression::
392
393  (i < j):
394    zone[i]->protection[j]
395    = (total sums of managed_pages from zone[i+1] to zone[j] on the node)
396      / lowmem_reserve_ratio[i];
397  (i = j):
398     (should not be protected. = 0;
399  (i > j):
400     (not necessary, but looks 0)
401
402The default values of lowmem_reserve_ratio[i] are
403
404    === ====================================
405    256 (if zone[i] means DMA or DMA32 zone)
406    32  (others)
407    === ====================================
408
409As above expression, they are reciprocal number of ratio.
410256 means 1/256. # of protection pages becomes about "0.39%" of total managed
411pages of higher zones on the node.
412
413If you would like to protect more pages, smaller values are effective.
414The minimum value is 1 (1/1 -> 100%). The value less than 1 completely
415disables protection of the pages.
416
417
418max_map_count:
419==============
420
421This file contains the maximum number of memory map areas a process
422may have. Memory map areas are used as a side-effect of calling
423malloc, directly by mmap, mprotect, and madvise, and also when loading
424shared libraries.
425
426While most applications need less than a thousand maps, certain
427programs, particularly malloc debuggers, may consume lots of them,
428e.g., up to one or two maps per allocation.
429
430The default value is 65530.
431
432
433memory_failure_early_kill:
434==========================
435
436Control how to kill processes when uncorrected memory error (typically
437a 2bit error in a memory module) is detected in the background by hardware
438that cannot be handled by the kernel. In some cases (like the page
439still having a valid copy on disk) the kernel will handle the failure
440transparently without affecting any applications. But if there is
441no other uptodate copy of the data it will kill to prevent any data
442corruptions from propagating.
443
4441: Kill all processes that have the corrupted and not reloadable page mapped
445as soon as the corruption is detected.  Note this is not supported
446for a few types of pages, like kernel internally allocated data or
447the swap cache, but works for the majority of user pages.
448
4490: Only unmap the corrupted page from all processes and only kill a process
450who tries to access it.
451
452The kill is done using a catchable SIGBUS with BUS_MCEERR_AO, so processes can
453handle this if they want to.
454
455This is only active on architectures/platforms with advanced machine
456check handling and depends on the hardware capabilities.
457
458Applications can override this setting individually with the PR_MCE_KILL prctl
459
460
461memory_failure_recovery
462=======================
463
464Enable memory failure recovery (when supported by the platform)
465
4661: Attempt recovery.
467
4680: Always panic on a memory failure.
469
470
471min_free_kbytes
472===============
473
474This is used to force the Linux VM to keep a minimum number
475of kilobytes free.  The VM uses this number to compute a
476watermark[WMARK_MIN] value for each lowmem zone in the system.
477Each lowmem zone gets a number of reserved free pages based
478proportionally on its size.
479
480Some minimal amount of memory is needed to satisfy PF_MEMALLOC
481allocations; if you set this to lower than 1024KB, your system will
482become subtly broken, and prone to deadlock under high loads.
483
484Setting this too high will OOM your machine instantly.
485
486
487min_slab_ratio
488==============
489
490This is available only on NUMA kernels.
491
492A percentage of the total pages in each zone.  On Zone reclaim
493(fallback from the local zone occurs) slabs will be reclaimed if more
494than this percentage of pages in a zone are reclaimable slab pages.
495This insures that the slab growth stays under control even in NUMA
496systems that rarely perform global reclaim.
497
498The default is 5 percent.
499
500Note that slab reclaim is triggered in a per zone / node fashion.
501The process of reclaiming slab memory is currently not node specific
502and may not be fast.
503
504
505min_unmapped_ratio
506==================
507
508This is available only on NUMA kernels.
509
510This is a percentage of the total pages in each zone. Zone reclaim will
511only occur if more than this percentage of pages are in a state that
512zone_reclaim_mode allows to be reclaimed.
513
514If zone_reclaim_mode has the value 4 OR'd, then the percentage is compared
515against all file-backed unmapped pages including swapcache pages and tmpfs
516files. Otherwise, only unmapped pages backed by normal files but not tmpfs
517files and similar are considered.
518
519The default is 1 percent.
520
521
522mmap_min_addr
523=============
524
525This file indicates the amount of address space  which a user process will
526be restricted from mmapping.  Since kernel null dereference bugs could
527accidentally operate based on the information in the first couple of pages
528of memory userspace processes should not be allowed to write to them.  By
529default this value is set to 0 and no protections will be enforced by the
530security module.  Setting this value to something like 64k will allow the
531vast majority of applications to work correctly and provide defense in depth
532against future potential kernel bugs.
533
534
535mmap_rnd_bits
536=============
537
538This value can be used to select the number of bits to use to
539determine the random offset to the base address of vma regions
540resulting from mmap allocations on architectures which support
541tuning address space randomization.  This value will be bounded
542by the architecture's minimum and maximum supported values.
543
544This value can be changed after boot using the
545/proc/sys/vm/mmap_rnd_bits tunable
546
547
548mmap_rnd_compat_bits
549====================
550
551This value can be used to select the number of bits to use to
552determine the random offset to the base address of vma regions
553resulting from mmap allocations for applications run in
554compatibility mode on architectures which support tuning address
555space randomization.  This value will be bounded by the
556architecture's minimum and maximum supported values.
557
558This value can be changed after boot using the
559/proc/sys/vm/mmap_rnd_compat_bits tunable
560
561
562nr_hugepages
563============
564
565Change the minimum size of the hugepage pool.
566
567See Documentation/admin-guide/mm/hugetlbpage.rst
568
569
570nr_hugepages_mempolicy
571======================
572
573Change the size of the hugepage pool at run-time on a specific
574set of NUMA nodes.
575
576See Documentation/admin-guide/mm/hugetlbpage.rst
577
578
579nr_overcommit_hugepages
580=======================
581
582Change the maximum size of the hugepage pool. The maximum is
583nr_hugepages + nr_overcommit_hugepages.
584
585See Documentation/admin-guide/mm/hugetlbpage.rst
586
587
588nr_trim_pages
589=============
590
591This is available only on NOMMU kernels.
592
593This value adjusts the excess page trimming behaviour of power-of-2 aligned
594NOMMU mmap allocations.
595
596A value of 0 disables trimming of allocations entirely, while a value of 1
597trims excess pages aggressively. Any value >= 1 acts as the watermark where
598trimming of allocations is initiated.
599
600The default value is 1.
601
602See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
603
604
605numa_zonelist_order
606===================
607
608This sysctl is only for NUMA and it is deprecated. Anything but
609Node order will fail!
610
611'where the memory is allocated from' is controlled by zonelists.
612
613(This documentation ignores ZONE_HIGHMEM/ZONE_DMA32 for simple explanation.
614you may be able to read ZONE_DMA as ZONE_DMA32...)
615
616In non-NUMA case, a zonelist for GFP_KERNEL is ordered as following.
617ZONE_NORMAL -> ZONE_DMA
618This means that a memory allocation request for GFP_KERNEL will
619get memory from ZONE_DMA only when ZONE_NORMAL is not available.
620
621In NUMA case, you can think of following 2 types of order.
622Assume 2 node NUMA and below is zonelist of Node(0)'s GFP_KERNEL::
623
624  (A) Node(0) ZONE_NORMAL -> Node(0) ZONE_DMA -> Node(1) ZONE_NORMAL
625  (B) Node(0) ZONE_NORMAL -> Node(1) ZONE_NORMAL -> Node(0) ZONE_DMA.
626
627Type(A) offers the best locality for processes on Node(0), but ZONE_DMA
628will be used before ZONE_NORMAL exhaustion. This increases possibility of
629out-of-memory(OOM) of ZONE_DMA because ZONE_DMA is tend to be small.
630
631Type(B) cannot offer the best locality but is more robust against OOM of
632the DMA zone.
633
634Type(A) is called as "Node" order. Type (B) is "Zone" order.
635
636"Node order" orders the zonelists by node, then by zone within each node.
637Specify "[Nn]ode" for node order
638
639"Zone Order" orders the zonelists by zone type, then by node within each
640zone.  Specify "[Zz]one" for zone order.
641
642Specify "[Dd]efault" to request automatic configuration.
643
644On 32-bit, the Normal zone needs to be preserved for allocations accessible
645by the kernel, so "zone" order will be selected.
646
647On 64-bit, devices that require DMA32/DMA are relatively rare, so "node"
648order will be selected.
649
650Default order is recommended unless this is causing problems for your
651system/application.
652
653
654oom_dump_tasks
655==============
656
657Enables a system-wide task dump (excluding kernel threads) to be produced
658when the kernel performs an OOM-killing and includes such information as
659pid, uid, tgid, vm size, rss, pgtables_bytes, swapents, oom_score_adj
660score, and name.  This is helpful to determine why the OOM killer was
661invoked, to identify the rogue task that caused it, and to determine why
662the OOM killer chose the task it did to kill.
663
664If this is set to zero, this information is suppressed.  On very
665large systems with thousands of tasks it may not be feasible to dump
666the memory state information for each one.  Such systems should not
667be forced to incur a performance penalty in OOM conditions when the
668information may not be desired.
669
670If this is set to non-zero, this information is shown whenever the
671OOM killer actually kills a memory-hogging task.
672
673The default value is 1 (enabled).
674
675
676oom_kill_allocating_task
677========================
678
679This enables or disables killing the OOM-triggering task in
680out-of-memory situations.
681
682If this is set to zero, the OOM killer will scan through the entire
683tasklist and select a task based on heuristics to kill.  This normally
684selects a rogue memory-hogging task that frees up a large amount of
685memory when killed.
686
687If this is set to non-zero, the OOM killer simply kills the task that
688triggered the out-of-memory condition.  This avoids the expensive
689tasklist scan.
690
691If panic_on_oom is selected, it takes precedence over whatever value
692is used in oom_kill_allocating_task.
693
694The default value is 0.
695
696
697overcommit_kbytes
698=================
699
700When overcommit_memory is set to 2, the committed address space is not
701permitted to exceed swap plus this amount of physical RAM. See below.
702
703Note: overcommit_kbytes is the counterpart of overcommit_ratio. Only one
704of them may be specified at a time. Setting one disables the other (which
705then appears as 0 when read).
706
707
708overcommit_memory
709=================
710
711This value contains a flag that enables memory overcommitment.
712
713When this flag is 0, the kernel attempts to estimate the amount
714of free memory left when userspace requests more memory.
715
716When this flag is 1, the kernel pretends there is always enough
717memory until it actually runs out.
718
719When this flag is 2, the kernel uses a "never overcommit"
720policy that attempts to prevent any overcommit of memory.
721Note that user_reserve_kbytes affects this policy.
722
723This feature can be very useful because there are a lot of
724programs that malloc() huge amounts of memory "just-in-case"
725and don't use much of it.
726
727The default value is 0.
728
729See Documentation/vm/overcommit-accounting.rst and
730mm/util.c::__vm_enough_memory() for more information.
731
732
733overcommit_ratio
734================
735
736When overcommit_memory is set to 2, the committed address
737space is not permitted to exceed swap plus this percentage
738of physical RAM.  See above.
739
740
741page-cluster
742============
743
744page-cluster controls the number of pages up to which consecutive pages
745are read in from swap in a single attempt. This is the swap counterpart
746to page cache readahead.
747The mentioned consecutivity is not in terms of virtual/physical addresses,
748but consecutive on swap space - that means they were swapped out together.
749
750It is a logarithmic value - setting it to zero means "1 page", setting
751it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
752Zero disables swap readahead completely.
753
754The default value is three (eight pages at a time).  There may be some
755small benefits in tuning this to a different value if your workload is
756swap-intensive.
757
758Lower values mean lower latencies for initial faults, but at the same time
759extra faults and I/O delays for following faults if they would have been part of
760that consecutive pages readahead would have brought in.
761
762
763panic_on_oom
764============
765
766This enables or disables panic on out-of-memory feature.
767
768If this is set to 0, the kernel will kill some rogue process,
769called oom_killer.  Usually, oom_killer can kill rogue processes and
770system will survive.
771
772If this is set to 1, the kernel panics when out-of-memory happens.
773However, if a process limits using nodes by mempolicy/cpusets,
774and those nodes become memory exhaustion status, one process
775may be killed by oom-killer. No panic occurs in this case.
776Because other nodes' memory may be free. This means system total status
777may be not fatal yet.
778
779If this is set to 2, the kernel panics compulsorily even on the
780above-mentioned. Even oom happens under memory cgroup, the whole
781system panics.
782
783The default value is 0.
784
7851 and 2 are for failover of clustering. Please select either
786according to your policy of failover.
787
788panic_on_oom=2+kdump gives you very strong tool to investigate
789why oom happens. You can get snapshot.
790
791
792stat_interval
793=============
794
795The time interval between which vm statistics are updated.  The default
796is 1 second.
797
798
799stat_refresh
800============
801
802Any read or write (by root only) flushes all the per-cpu vm statistics
803into their global totals, for more accurate reports when testing
804e.g. cat /proc/sys/vm/stat_refresh /proc/meminfo
805
806As a side-effect, it also checks for negative totals (elsewhere reported
807as 0) and "fails" with EINVAL if any are found, with a warning in dmesg.
808(At time of writing, a few stats are known sometimes to be found negative,
809with no ill effects: errors and warnings on these stats are suppressed.)
810
811
812numa_stat
813=========
814
815This interface allows runtime configuration of numa statistics.
816
817When page allocation performance becomes a bottleneck and you can tolerate
818some possible tool breakage and decreased numa counter precision, you can
819do::
820
821	echo 0 > /proc/sys/vm/numa_stat
822
823When page allocation performance is not a bottleneck and you want all
824tooling to work, you can do::
825
826	echo 1 > /proc/sys/vm/numa_stat
827
828
829swappiness
830==========
831
832This control is used to define the rough relative IO cost of swapping
833and filesystem paging, as a value between 0 and 200. At 100, the VM
834assumes equal IO cost and will thus apply memory pressure to the page
835cache and swap-backed pages equally; lower values signify more
836expensive swap IO, higher values indicates cheaper.
837
838Keep in mind that filesystem IO patterns under memory pressure tend to
839be more efficient than swap's random IO. An optimal value will require
840experimentation and will also be workload-dependent.
841
842The default value is 60.
843
844For in-memory swap, like zram or zswap, as well as hybrid setups that
845have swap on faster devices than the filesystem, values beyond 100 can
846be considered. For example, if the random IO against the swap device
847is on average 2x faster than IO from the filesystem, swappiness should
848be 133 (x + 2x = 200, 2x = 133.33).
849
850At 0, the kernel will not initiate swap until the amount of free and
851file-backed pages is less than the high watermark in a zone.
852
853
854unprivileged_userfaultfd
855========================
856
857This flag controls the mode in which unprivileged users can use the
858userfaultfd system calls. Set this to 0 to restrict unprivileged users
859to handle page faults in user mode only. In this case, users without
860SYS_CAP_PTRACE must pass UFFD_USER_MODE_ONLY in order for userfaultfd to
861succeed. Prohibiting use of userfaultfd for handling faults from kernel
862mode may make certain vulnerabilities more difficult to exploit.
863
864Set this to 1 to allow unprivileged users to use the userfaultfd system
865calls without any restrictions.
866
867The default value is 0.
868
869
870user_reserve_kbytes
871===================
872
873When overcommit_memory is set to 2, "never overcommit" mode, reserve
874min(3% of current process size, user_reserve_kbytes) of free memory.
875This is intended to prevent a user from starting a single memory hogging
876process, such that they cannot recover (kill the hog).
877
878user_reserve_kbytes defaults to min(3% of the current process size, 128MB).
879
880If this is reduced to zero, then the user will be allowed to allocate
881all free memory with a single process, minus admin_reserve_kbytes.
882Any subsequent attempts to execute a command will result in
883"fork: Cannot allocate memory".
884
885Changing this takes effect whenever an application requests memory.
886
887
888vfs_cache_pressure
889==================
890
891This percentage value controls the tendency of the kernel to reclaim
892the memory which is used for caching of directory and inode objects.
893
894At the default value of vfs_cache_pressure=100 the kernel will attempt to
895reclaim dentries and inodes at a "fair" rate with respect to pagecache and
896swapcache reclaim.  Decreasing vfs_cache_pressure causes the kernel to prefer
897to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will
898never reclaim dentries and inodes due to memory pressure and this can easily
899lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100
900causes the kernel to prefer to reclaim dentries and inodes.
901
902Increasing vfs_cache_pressure significantly beyond 100 may have negative
903performance impact. Reclaim code needs to take various locks to find freeable
904directory and inode objects. With vfs_cache_pressure=1000, it will look for
905ten times more freeable objects than there are.
906
907
908watermark_boost_factor
909======================
910
911This factor controls the level of reclaim when memory is being fragmented.
912It defines the percentage of the high watermark of a zone that will be
913reclaimed if pages of different mobility are being mixed within pageblocks.
914The intent is that compaction has less work to do in the future and to
915increase the success rate of future high-order allocations such as SLUB
916allocations, THP and hugetlbfs pages.
917
918To make it sensible with respect to the watermark_scale_factor
919parameter, the unit is in fractions of 10,000. The default value of
92015,000 on !DISCONTIGMEM configurations means that up to 150% of the high
921watermark will be reclaimed in the event of a pageblock being mixed due
922to fragmentation. The level of reclaim is determined by the number of
923fragmentation events that occurred in the recent past. If this value is
924smaller than a pageblock then a pageblocks worth of pages will be reclaimed
925(e.g.  2MB on 64-bit x86). A boost factor of 0 will disable the feature.
926
927
928watermark_scale_factor
929======================
930
931This factor controls the aggressiveness of kswapd. It defines the
932amount of memory left in a node/system before kswapd is woken up and
933how much memory needs to be free before kswapd goes back to sleep.
934
935The unit is in fractions of 10,000. The default value of 10 means the
936distances between watermarks are 0.1% of the available memory in the
937node/system. The maximum value is 1000, or 10% of memory.
938
939A high rate of threads entering direct reclaim (allocstall) or kswapd
940going to sleep prematurely (kswapd_low_wmark_hit_quickly) can indicate
941that the number of free pages kswapd maintains for latency reasons is
942too small for the allocation bursts occurring in the system. This knob
943can then be used to tune kswapd aggressiveness accordingly.
944
945
946zone_reclaim_mode
947=================
948
949Zone_reclaim_mode allows someone to set more or less aggressive approaches to
950reclaim memory when a zone runs out of memory. If it is set to zero then no
951zone reclaim occurs. Allocations will be satisfied from other zones / nodes
952in the system.
953
954This is value OR'ed together of
955
956=	===================================
9571	Zone reclaim on
9582	Zone reclaim writes dirty pages out
9594	Zone reclaim swaps pages
960=	===================================
961
962zone_reclaim_mode is disabled by default.  For file servers or workloads
963that benefit from having their data cached, zone_reclaim_mode should be
964left disabled as the caching effect is likely to be more important than
965data locality.
966
967Consider enabling one or more zone_reclaim mode bits if it's known that the
968workload is partitioned such that each partition fits within a NUMA node
969and that accessing remote memory would cause a measurable performance
970reduction.  The page allocator will take additional actions before
971allocating off node pages.
972
973Allowing zone reclaim to write out pages stops processes that are
974writing large amounts of data from dirtying pages on other nodes. Zone
975reclaim will write out dirty pages if a zone fills up and so effectively
976throttle the process. This may decrease the performance of a single process
977since it cannot use all of system memory to buffer the outgoing writes
978anymore but it preserve the memory on other nodes so that the performance
979of other processes running on other nodes will not be affected.
980
981Allowing regular swap effectively restricts allocations to the local
982node unless explicitly overridden by memory policies or cpuset
983configurations.
984