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