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