vm.txt 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913
  1. Documentation for /proc/sys/vm/* kernel version 2.6.29
  2. (c) 1998, 1999, Rik van Riel <riel@nl.linux.org>
  3. (c) 2008 Peter W. Morreale <pmorreale@novell.com>
  4. For general info and legal blurb, please look in README.
  5. ==============================================================
  6. This file contains the documentation for the sysctl files in
  7. /proc/sys/vm and is valid for Linux kernel version 2.6.29.
  8. The files in this directory can be used to tune the operation
  9. of the virtual memory (VM) subsystem of the Linux kernel and
  10. the writeout of dirty data to disk.
  11. Default values and initialization routines for most of these
  12. files can be found in mm/swap.c.
  13. Currently, these files are in /proc/sys/vm:
  14. - admin_reserve_kbytes
  15. - block_dump
  16. - compact_memory
  17. - compact_unevictable_allowed
  18. - dirty_background_bytes
  19. - dirty_background_ratio
  20. - dirty_bytes
  21. - dirty_expire_centisecs
  22. - dirty_ratio
  23. - dirtytime_expire_seconds
  24. - dirty_writeback_centisecs
  25. - drop_caches
  26. - extfrag_threshold
  27. - hugetlb_shm_group
  28. - laptop_mode
  29. - legacy_va_layout
  30. - lowmem_reserve_ratio
  31. - max_map_count
  32. - memory_failure_early_kill
  33. - memory_failure_recovery
  34. - min_free_kbytes
  35. - min_slab_ratio
  36. - min_unmapped_ratio
  37. - mmap_min_addr
  38. - mmap_rnd_bits
  39. - mmap_rnd_compat_bits
  40. - nr_hugepages
  41. - nr_hugepages_mempolicy
  42. - nr_overcommit_hugepages
  43. - nr_trim_pages (only if CONFIG_MMU=n)
  44. - numa_zonelist_order
  45. - oom_dump_tasks
  46. - oom_kill_allocating_task
  47. - overcommit_kbytes
  48. - overcommit_memory
  49. - overcommit_ratio
  50. - page-cluster
  51. - panic_on_oom
  52. - percpu_pagelist_fraction
  53. - stat_interval
  54. - stat_refresh
  55. - numa_stat
  56. - swappiness
  57. - user_reserve_kbytes
  58. - vfs_cache_pressure
  59. - watermark_scale_factor
  60. - zone_reclaim_mode
  61. ==============================================================
  62. admin_reserve_kbytes
  63. The amount of free memory in the system that should be reserved for users
  64. with the capability cap_sys_admin.
  65. admin_reserve_kbytes defaults to min(3% of free pages, 8MB)
  66. That should provide enough for the admin to log in and kill a process,
  67. if necessary, under the default overcommit 'guess' mode.
  68. Systems running under overcommit 'never' should increase this to account
  69. for the full Virtual Memory Size of programs used to recover. Otherwise,
  70. root may not be able to log in to recover the system.
  71. How do you calculate a minimum useful reserve?
  72. sshd or login + bash (or some other shell) + top (or ps, kill, etc.)
  73. For overcommit 'guess', we can sum resident set sizes (RSS).
  74. On x86_64 this is about 8MB.
  75. For overcommit 'never', we can take the max of their virtual sizes (VSZ)
  76. and add the sum of their RSS.
  77. On x86_64 this is about 128MB.
  78. Changing this takes effect whenever an application requests memory.
  79. ==============================================================
  80. block_dump
  81. block_dump enables block I/O debugging when set to a nonzero value. More
  82. information on block I/O debugging is in Documentation/laptops/laptop-mode.txt.
  83. ==============================================================
  84. compact_memory
  85. Available only when CONFIG_COMPACTION is set. When 1 is written to the file,
  86. all zones are compacted such that free memory is available in contiguous
  87. blocks where possible. This can be important for example in the allocation of
  88. huge pages although processes will also directly compact memory as required.
  89. ==============================================================
  90. compact_unevictable_allowed
  91. Available only when CONFIG_COMPACTION is set. When set to 1, compaction is
  92. allowed to examine the unevictable lru (mlocked pages) for pages to compact.
  93. This should be used on systems where stalls for minor page faults are an
  94. acceptable trade for large contiguous free memory. Set to 0 to prevent
  95. compaction from moving pages that are unevictable. Default value is 1.
  96. ==============================================================
  97. dirty_background_bytes
  98. Contains the amount of dirty memory at which the background kernel
  99. flusher threads will start writeback.
  100. Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only
  101. one of them may be specified at a time. When one sysctl is written it is
  102. immediately taken into account to evaluate the dirty memory limits and the
  103. other appears as 0 when read.
  104. ==============================================================
  105. dirty_background_ratio
  106. Contains, as a percentage of total available memory that contains free pages
  107. and reclaimable pages, the number of pages at which the background kernel
  108. flusher threads will start writing out dirty data.
  109. The total available memory is not equal to total system memory.
  110. ==============================================================
  111. dirty_bytes
  112. Contains the amount of dirty memory at which a process generating disk writes
  113. will itself start writeback.
  114. Note: dirty_bytes is the counterpart of dirty_ratio. Only one of them may be
  115. specified at a time. When one sysctl is written it is immediately taken into
  116. account to evaluate the dirty memory limits and the other appears as 0 when
  117. read.
  118. Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any
  119. value lower than this limit will be ignored and the old configuration will be
  120. retained.
  121. ==============================================================
  122. dirty_expire_centisecs
  123. This tunable is used to define when dirty data is old enough to be eligible
  124. for writeout by the kernel flusher threads. It is expressed in 100'ths
  125. of a second. Data which has been dirty in-memory for longer than this
  126. interval will be written out next time a flusher thread wakes up.
  127. ==============================================================
  128. dirty_ratio
  129. Contains, as a percentage of total available memory that contains free pages
  130. and reclaimable pages, the number of pages at which a process which is
  131. generating disk writes will itself start writing out dirty data.
  132. The total available memory is not equal to total system memory.
  133. ==============================================================
  134. dirtytime_expire_seconds
  135. When a lazytime inode is constantly having its pages dirtied, the inode with
  136. an updated timestamp will never get chance to be written out. And, if the
  137. only thing that has happened on the file system is a dirtytime inode caused
  138. by an atime update, a worker will be scheduled to make sure that inode
  139. eventually gets pushed out to disk. This tunable is used to define when dirty
  140. inode is old enough to be eligible for writeback by the kernel flusher threads.
  141. And, it is also used as the interval to wakeup dirtytime_writeback thread.
  142. ==============================================================
  143. dirty_writeback_centisecs
  144. The kernel flusher threads will periodically wake up and write `old' data
  145. out to disk. This tunable expresses the interval between those wakeups, in
  146. 100'ths of a second.
  147. Setting this to zero disables periodic writeback altogether.
  148. ==============================================================
  149. drop_caches
  150. Writing to this will cause the kernel to drop clean caches, as well as
  151. reclaimable slab objects like dentries and inodes. Once dropped, their
  152. memory becomes free.
  153. To free pagecache:
  154. echo 1 > /proc/sys/vm/drop_caches
  155. To free reclaimable slab objects (includes dentries and inodes):
  156. echo 2 > /proc/sys/vm/drop_caches
  157. To free slab objects and pagecache:
  158. echo 3 > /proc/sys/vm/drop_caches
  159. This is a non-destructive operation and will not free any dirty objects.
  160. To increase the number of objects freed by this operation, the user may run
  161. `sync' prior to writing to /proc/sys/vm/drop_caches. This will minimize the
  162. number of dirty objects on the system and create more candidates to be
  163. dropped.
  164. This file is not a means to control the growth of the various kernel caches
  165. (inodes, dentries, pagecache, etc...) These objects are automatically
  166. reclaimed by the kernel when memory is needed elsewhere on the system.
  167. Use of this file can cause performance problems. Since it discards cached
  168. objects, it may cost a significant amount of I/O and CPU to recreate the
  169. dropped objects, especially if they were under heavy use. Because of this,
  170. use outside of a testing or debugging environment is not recommended.
  171. You may see informational messages in your kernel log when this file is
  172. used:
  173. cat (1234): drop_caches: 3
  174. These are informational only. They do not mean that anything is wrong
  175. with your system. To disable them, echo 4 (bit 3) into drop_caches.
  176. ==============================================================
  177. extfrag_threshold
  178. This parameter affects whether the kernel will compact memory or direct
  179. reclaim to satisfy a high-order allocation. The extfrag/extfrag_index file in
  180. debugfs shows what the fragmentation index for each order is in each zone in
  181. the system. Values tending towards 0 imply allocations would fail due to lack
  182. of memory, values towards 1000 imply failures are due to fragmentation and -1
  183. implies that the allocation will succeed as long as watermarks are met.
  184. The kernel will not compact memory in a zone if the
  185. fragmentation index is <= extfrag_threshold. The default value is 500.
  186. ==============================================================
  187. highmem_is_dirtyable
  188. Available only for systems with CONFIG_HIGHMEM enabled (32b systems).
  189. This parameter controls whether the high memory is considered for dirty
  190. writers throttling. This is not the case by default which means that
  191. only the amount of memory directly visible/usable by the kernel can
  192. be dirtied. As a result, on systems with a large amount of memory and
  193. lowmem basically depleted writers might be throttled too early and
  194. streaming writes can get very slow.
  195. Changing the value to non zero would allow more memory to be dirtied
  196. and thus allow writers to write more data which can be flushed to the
  197. storage more effectively. Note this also comes with a risk of pre-mature
  198. OOM killer because some writers (e.g. direct block device writes) can
  199. only use the low memory and they can fill it up with dirty data without
  200. any throttling.
  201. ==============================================================
  202. hugetlb_shm_group
  203. hugetlb_shm_group contains group id that is allowed to create SysV
  204. shared memory segment using hugetlb page.
  205. ==============================================================
  206. laptop_mode
  207. laptop_mode is a knob that controls "laptop mode". All the things that are
  208. controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt.
  209. ==============================================================
  210. legacy_va_layout
  211. If non-zero, this sysctl disables the new 32-bit mmap layout - the kernel
  212. will use the legacy (2.4) layout for all processes.
  213. ==============================================================
  214. lowmem_reserve_ratio
  215. For some specialised workloads on highmem machines it is dangerous for
  216. the kernel to allow process memory to be allocated from the "lowmem"
  217. zone. This is because that memory could then be pinned via the mlock()
  218. system call, or by unavailability of swapspace.
  219. And on large highmem machines this lack of reclaimable lowmem memory
  220. can be fatal.
  221. So the Linux page allocator has a mechanism which prevents allocations
  222. which _could_ use highmem from using too much lowmem. This means that
  223. a certain amount of lowmem is defended from the possibility of being
  224. captured into pinned user memory.
  225. (The same argument applies to the old 16 megabyte ISA DMA region. This
  226. mechanism will also defend that region from allocations which could use
  227. highmem or lowmem).
  228. The `lowmem_reserve_ratio' tunable determines how aggressive the kernel is
  229. in defending these lower zones.
  230. If you have a machine which uses highmem or ISA DMA and your
  231. applications are using mlock(), or if you are running with no swap then
  232. you probably should change the lowmem_reserve_ratio setting.
  233. The lowmem_reserve_ratio is an array. You can see them by reading this file.
  234. -
  235. % cat /proc/sys/vm/lowmem_reserve_ratio
  236. 256 256 32
  237. -
  238. But, these values are not used directly. The kernel calculates # of protection
  239. pages for each zones from them. These are shown as array of protection pages
  240. in /proc/zoneinfo like followings. (This is an example of x86-64 box).
  241. Each zone has an array of protection pages like this.
  242. -
  243. Node 0, zone DMA
  244. pages free 1355
  245. min 3
  246. low 3
  247. high 4
  248. :
  249. :
  250. numa_other 0
  251. protection: (0, 2004, 2004, 2004)
  252. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  253. pagesets
  254. cpu: 0 pcp: 0
  255. :
  256. -
  257. These protections are added to score to judge whether this zone should be used
  258. for page allocation or should be reclaimed.
  259. In this example, if normal pages (index=2) are required to this DMA zone and
  260. watermark[WMARK_HIGH] is used for watermark, the kernel judges this zone should
  261. not be used because pages_free(1355) is smaller than watermark + protection[2]
  262. (4 + 2004 = 2008). If this protection value is 0, this zone would be used for
  263. normal page requirement. If requirement is DMA zone(index=0), protection[0]
  264. (=0) is used.
  265. zone[i]'s protection[j] is calculated by following expression.
  266. (i < j):
  267. zone[i]->protection[j]
  268. = (total sums of managed_pages from zone[i+1] to zone[j] on the node)
  269. / lowmem_reserve_ratio[i];
  270. (i = j):
  271. (should not be protected. = 0;
  272. (i > j):
  273. (not necessary, but looks 0)
  274. The default values of lowmem_reserve_ratio[i] are
  275. 256 (if zone[i] means DMA or DMA32 zone)
  276. 32 (others).
  277. As above expression, they are reciprocal number of ratio.
  278. 256 means 1/256. # of protection pages becomes about "0.39%" of total managed
  279. pages of higher zones on the node.
  280. If you would like to protect more pages, smaller values are effective.
  281. The minimum value is 1 (1/1 -> 100%). The value less than 1 completely
  282. disables protection of the pages.
  283. ==============================================================
  284. max_map_count:
  285. This file contains the maximum number of memory map areas a process
  286. may have. Memory map areas are used as a side-effect of calling
  287. malloc, directly by mmap, mprotect, and madvise, and also when loading
  288. shared libraries.
  289. While most applications need less than a thousand maps, certain
  290. programs, particularly malloc debuggers, may consume lots of them,
  291. e.g., up to one or two maps per allocation.
  292. The default value is 65536.
  293. =============================================================
  294. memory_failure_early_kill:
  295. Control how to kill processes when uncorrected memory error (typically
  296. a 2bit error in a memory module) is detected in the background by hardware
  297. that cannot be handled by the kernel. In some cases (like the page
  298. still having a valid copy on disk) the kernel will handle the failure
  299. transparently without affecting any applications. But if there is
  300. no other uptodate copy of the data it will kill to prevent any data
  301. corruptions from propagating.
  302. 1: Kill all processes that have the corrupted and not reloadable page mapped
  303. as soon as the corruption is detected. Note this is not supported
  304. for a few types of pages, like kernel internally allocated data or
  305. the swap cache, but works for the majority of user pages.
  306. 0: Only unmap the corrupted page from all processes and only kill a process
  307. who tries to access it.
  308. The kill is done using a catchable SIGBUS with BUS_MCEERR_AO, so processes can
  309. handle this if they want to.
  310. This is only active on architectures/platforms with advanced machine
  311. check handling and depends on the hardware capabilities.
  312. Applications can override this setting individually with the PR_MCE_KILL prctl
  313. ==============================================================
  314. memory_failure_recovery
  315. Enable memory failure recovery (when supported by the platform)
  316. 1: Attempt recovery.
  317. 0: Always panic on a memory failure.
  318. ==============================================================
  319. min_free_kbytes:
  320. This is used to force the Linux VM to keep a minimum number
  321. of kilobytes free. The VM uses this number to compute a
  322. watermark[WMARK_MIN] value for each lowmem zone in the system.
  323. Each lowmem zone gets a number of reserved free pages based
  324. proportionally on its size.
  325. Some minimal amount of memory is needed to satisfy PF_MEMALLOC
  326. allocations; if you set this to lower than 1024KB, your system will
  327. become subtly broken, and prone to deadlock under high loads.
  328. Setting this too high will OOM your machine instantly.
  329. =============================================================
  330. min_slab_ratio:
  331. This is available only on NUMA kernels.
  332. A percentage of the total pages in each zone. On Zone reclaim
  333. (fallback from the local zone occurs) slabs will be reclaimed if more
  334. than this percentage of pages in a zone are reclaimable slab pages.
  335. This insures that the slab growth stays under control even in NUMA
  336. systems that rarely perform global reclaim.
  337. The default is 5 percent.
  338. Note that slab reclaim is triggered in a per zone / node fashion.
  339. The process of reclaiming slab memory is currently not node specific
  340. and may not be fast.
  341. =============================================================
  342. min_unmapped_ratio:
  343. This is available only on NUMA kernels.
  344. This is a percentage of the total pages in each zone. Zone reclaim will
  345. only occur if more than this percentage of pages are in a state that
  346. zone_reclaim_mode allows to be reclaimed.
  347. If zone_reclaim_mode has the value 4 OR'd, then the percentage is compared
  348. against all file-backed unmapped pages including swapcache pages and tmpfs
  349. files. Otherwise, only unmapped pages backed by normal files but not tmpfs
  350. files and similar are considered.
  351. The default is 1 percent.
  352. ==============================================================
  353. mmap_min_addr
  354. This file indicates the amount of address space which a user process will
  355. be restricted from mmapping. Since kernel null dereference bugs could
  356. accidentally operate based on the information in the first couple of pages
  357. of memory userspace processes should not be allowed to write to them. By
  358. default this value is set to 0 and no protections will be enforced by the
  359. security module. Setting this value to something like 64k will allow the
  360. vast majority of applications to work correctly and provide defense in depth
  361. against future potential kernel bugs.
  362. ==============================================================
  363. mmap_rnd_bits:
  364. This value can be used to select the number of bits to use to
  365. determine the random offset to the base address of vma regions
  366. resulting from mmap allocations on architectures which support
  367. tuning address space randomization. This value will be bounded
  368. by the architecture's minimum and maximum supported values.
  369. This value can be changed after boot using the
  370. /proc/sys/vm/mmap_rnd_bits tunable
  371. ==============================================================
  372. mmap_rnd_compat_bits:
  373. This value can be used to select the number of bits to use to
  374. determine the random offset to the base address of vma regions
  375. resulting from mmap allocations for applications run in
  376. compatibility mode on architectures which support tuning address
  377. space randomization. This value will be bounded by the
  378. architecture's minimum and maximum supported values.
  379. This value can be changed after boot using the
  380. /proc/sys/vm/mmap_rnd_compat_bits tunable
  381. ==============================================================
  382. nr_hugepages
  383. Change the minimum size of the hugepage pool.
  384. See Documentation/admin-guide/mm/hugetlbpage.rst
  385. ==============================================================
  386. nr_hugepages_mempolicy
  387. Change the size of the hugepage pool at run-time on a specific
  388. set of NUMA nodes.
  389. See Documentation/admin-guide/mm/hugetlbpage.rst
  390. ==============================================================
  391. nr_overcommit_hugepages
  392. Change the maximum size of the hugepage pool. The maximum is
  393. nr_hugepages + nr_overcommit_hugepages.
  394. See Documentation/admin-guide/mm/hugetlbpage.rst
  395. ==============================================================
  396. nr_trim_pages
  397. This is available only on NOMMU kernels.
  398. This value adjusts the excess page trimming behaviour of power-of-2 aligned
  399. NOMMU mmap allocations.
  400. A value of 0 disables trimming of allocations entirely, while a value of 1
  401. trims excess pages aggressively. Any value >= 1 acts as the watermark where
  402. trimming of allocations is initiated.
  403. The default value is 1.
  404. See Documentation/nommu-mmap.txt for more information.
  405. ==============================================================
  406. numa_zonelist_order
  407. This sysctl is only for NUMA and it is deprecated. Anything but
  408. Node order will fail!
  409. 'where the memory is allocated from' is controlled by zonelists.
  410. (This documentation ignores ZONE_HIGHMEM/ZONE_DMA32 for simple explanation.
  411. you may be able to read ZONE_DMA as ZONE_DMA32...)
  412. In non-NUMA case, a zonelist for GFP_KERNEL is ordered as following.
  413. ZONE_NORMAL -> ZONE_DMA
  414. This means that a memory allocation request for GFP_KERNEL will
  415. get memory from ZONE_DMA only when ZONE_NORMAL is not available.
  416. In NUMA case, you can think of following 2 types of order.
  417. Assume 2 node NUMA and below is zonelist of Node(0)'s GFP_KERNEL
  418. (A) Node(0) ZONE_NORMAL -> Node(0) ZONE_DMA -> Node(1) ZONE_NORMAL
  419. (B) Node(0) ZONE_NORMAL -> Node(1) ZONE_NORMAL -> Node(0) ZONE_DMA.
  420. Type(A) offers the best locality for processes on Node(0), but ZONE_DMA
  421. will be used before ZONE_NORMAL exhaustion. This increases possibility of
  422. out-of-memory(OOM) of ZONE_DMA because ZONE_DMA is tend to be small.
  423. Type(B) cannot offer the best locality but is more robust against OOM of
  424. the DMA zone.
  425. Type(A) is called as "Node" order. Type (B) is "Zone" order.
  426. "Node order" orders the zonelists by node, then by zone within each node.
  427. Specify "[Nn]ode" for node order
  428. "Zone Order" orders the zonelists by zone type, then by node within each
  429. zone. Specify "[Zz]one" for zone order.
  430. Specify "[Dd]efault" to request automatic configuration.
  431. On 32-bit, the Normal zone needs to be preserved for allocations accessible
  432. by the kernel, so "zone" order will be selected.
  433. On 64-bit, devices that require DMA32/DMA are relatively rare, so "node"
  434. order will be selected.
  435. Default order is recommended unless this is causing problems for your
  436. system/application.
  437. ==============================================================
  438. oom_dump_tasks
  439. Enables a system-wide task dump (excluding kernel threads) to be produced
  440. when the kernel performs an OOM-killing and includes such information as
  441. pid, uid, tgid, vm size, rss, pgtables_bytes, swapents, oom_score_adj
  442. score, and name. This is helpful to determine why the OOM killer was
  443. invoked, to identify the rogue task that caused it, and to determine why
  444. the OOM killer chose the task it did to kill.
  445. If this is set to zero, this information is suppressed. On very
  446. large systems with thousands of tasks it may not be feasible to dump
  447. the memory state information for each one. Such systems should not
  448. be forced to incur a performance penalty in OOM conditions when the
  449. information may not be desired.
  450. If this is set to non-zero, this information is shown whenever the
  451. OOM killer actually kills a memory-hogging task.
  452. The default value is 1 (enabled).
  453. ==============================================================
  454. oom_kill_allocating_task
  455. This enables or disables killing the OOM-triggering task in
  456. out-of-memory situations.
  457. If this is set to zero, the OOM killer will scan through the entire
  458. tasklist and select a task based on heuristics to kill. This normally
  459. selects a rogue memory-hogging task that frees up a large amount of
  460. memory when killed.
  461. If this is set to non-zero, the OOM killer simply kills the task that
  462. triggered the out-of-memory condition. This avoids the expensive
  463. tasklist scan.
  464. If panic_on_oom is selected, it takes precedence over whatever value
  465. is used in oom_kill_allocating_task.
  466. The default value is 0.
  467. ==============================================================
  468. overcommit_kbytes:
  469. When overcommit_memory is set to 2, the committed address space is not
  470. permitted to exceed swap plus this amount of physical RAM. See below.
  471. Note: overcommit_kbytes is the counterpart of overcommit_ratio. Only one
  472. of them may be specified at a time. Setting one disables the other (which
  473. then appears as 0 when read).
  474. ==============================================================
  475. overcommit_memory:
  476. This value contains a flag that enables memory overcommitment.
  477. When this flag is 0, the kernel attempts to estimate the amount
  478. of free memory left when userspace requests more memory.
  479. When this flag is 1, the kernel pretends there is always enough
  480. memory until it actually runs out.
  481. When this flag is 2, the kernel uses a "never overcommit"
  482. policy that attempts to prevent any overcommit of memory.
  483. Note that user_reserve_kbytes affects this policy.
  484. This feature can be very useful because there are a lot of
  485. programs that malloc() huge amounts of memory "just-in-case"
  486. and don't use much of it.
  487. The default value is 0.
  488. See Documentation/vm/overcommit-accounting.rst and
  489. mm/util.c::__vm_enough_memory() for more information.
  490. ==============================================================
  491. overcommit_ratio:
  492. When overcommit_memory is set to 2, the committed address
  493. space is not permitted to exceed swap plus this percentage
  494. of physical RAM. See above.
  495. ==============================================================
  496. page-cluster
  497. page-cluster controls the number of pages up to which consecutive pages
  498. are read in from swap in a single attempt. This is the swap counterpart
  499. to page cache readahead.
  500. The mentioned consecutivity is not in terms of virtual/physical addresses,
  501. but consecutive on swap space - that means they were swapped out together.
  502. It is a logarithmic value - setting it to zero means "1 page", setting
  503. it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
  504. Zero disables swap readahead completely.
  505. The default value is three (eight pages at a time). There may be some
  506. small benefits in tuning this to a different value if your workload is
  507. swap-intensive.
  508. Lower values mean lower latencies for initial faults, but at the same time
  509. extra faults and I/O delays for following faults if they would have been part of
  510. that consecutive pages readahead would have brought in.
  511. =============================================================
  512. panic_on_oom
  513. This enables or disables panic on out-of-memory feature.
  514. If this is set to 0, the kernel will kill some rogue process,
  515. called oom_killer. Usually, oom_killer can kill rogue processes and
  516. system will survive.
  517. If this is set to 1, the kernel panics when out-of-memory happens.
  518. However, if a process limits using nodes by mempolicy/cpusets,
  519. and those nodes become memory exhaustion status, one process
  520. may be killed by oom-killer. No panic occurs in this case.
  521. Because other nodes' memory may be free. This means system total status
  522. may be not fatal yet.
  523. If this is set to 2, the kernel panics compulsorily even on the
  524. above-mentioned. Even oom happens under memory cgroup, the whole
  525. system panics.
  526. The default value is 0.
  527. 1 and 2 are for failover of clustering. Please select either
  528. according to your policy of failover.
  529. panic_on_oom=2+kdump gives you very strong tool to investigate
  530. why oom happens. You can get snapshot.
  531. =============================================================
  532. percpu_pagelist_fraction
  533. This is the fraction of pages at most (high mark pcp->high) in each zone that
  534. are allocated for each per cpu page list. The min value for this is 8. It
  535. means that we don't allow more than 1/8th of pages in each zone to be
  536. allocated in any single per_cpu_pagelist. This entry only changes the value
  537. of hot per cpu pagelists. User can specify a number like 100 to allocate
  538. 1/100th of each zone to each per cpu page list.
  539. The batch value of each per cpu pagelist is also updated as a result. It is
  540. set to pcp->high/4. The upper limit of batch is (PAGE_SHIFT * 8)
  541. The initial value is zero. Kernel does not use this value at boot time to set
  542. the high water marks for each per cpu page list. If the user writes '0' to this
  543. sysctl, it will revert to this default behavior.
  544. ==============================================================
  545. stat_interval
  546. The time interval between which vm statistics are updated. The default
  547. is 1 second.
  548. ==============================================================
  549. stat_refresh
  550. Any read or write (by root only) flushes all the per-cpu vm statistics
  551. into their global totals, for more accurate reports when testing
  552. e.g. cat /proc/sys/vm/stat_refresh /proc/meminfo
  553. As a side-effect, it also checks for negative totals (elsewhere reported
  554. as 0) and "fails" with EINVAL if any are found, with a warning in dmesg.
  555. (At time of writing, a few stats are known sometimes to be found negative,
  556. with no ill effects: errors and warnings on these stats are suppressed.)
  557. ==============================================================
  558. numa_stat
  559. This interface allows runtime configuration of numa statistics.
  560. When page allocation performance becomes a bottleneck and you can tolerate
  561. some possible tool breakage and decreased numa counter precision, you can
  562. do:
  563. echo 0 > /proc/sys/vm/numa_stat
  564. When page allocation performance is not a bottleneck and you want all
  565. tooling to work, you can do:
  566. echo 1 > /proc/sys/vm/numa_stat
  567. ==============================================================
  568. swappiness
  569. This control is used to define how aggressive the kernel will swap
  570. memory pages. Higher values will increase aggressiveness, lower values
  571. decrease the amount of swap. A value of 0 instructs the kernel not to
  572. initiate swap until the amount of free and file-backed pages is less
  573. than the high water mark in a zone.
  574. The default value is 60.
  575. ==============================================================
  576. - user_reserve_kbytes
  577. When overcommit_memory is set to 2, "never overcommit" mode, reserve
  578. min(3% of current process size, user_reserve_kbytes) of free memory.
  579. This is intended to prevent a user from starting a single memory hogging
  580. process, such that they cannot recover (kill the hog).
  581. user_reserve_kbytes defaults to min(3% of the current process size, 128MB).
  582. If this is reduced to zero, then the user will be allowed to allocate
  583. all free memory with a single process, minus admin_reserve_kbytes.
  584. Any subsequent attempts to execute a command will result in
  585. "fork: Cannot allocate memory".
  586. Changing this takes effect whenever an application requests memory.
  587. ==============================================================
  588. vfs_cache_pressure
  589. ------------------
  590. This percentage value controls the tendency of the kernel to reclaim
  591. the memory which is used for caching of directory and inode objects.
  592. At the default value of vfs_cache_pressure=100 the kernel will attempt to
  593. reclaim dentries and inodes at a "fair" rate with respect to pagecache and
  594. swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer
  595. to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will
  596. never reclaim dentries and inodes due to memory pressure and this can easily
  597. lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100
  598. causes the kernel to prefer to reclaim dentries and inodes.
  599. Increasing vfs_cache_pressure significantly beyond 100 may have negative
  600. performance impact. Reclaim code needs to take various locks to find freeable
  601. directory and inode objects. With vfs_cache_pressure=1000, it will look for
  602. ten times more freeable objects than there are.
  603. =============================================================
  604. watermark_scale_factor:
  605. This factor controls the aggressiveness of kswapd. It defines the
  606. amount of memory left in a node/system before kswapd is woken up and
  607. how much memory needs to be free before kswapd goes back to sleep.
  608. The unit is in fractions of 10,000. The default value of 10 means the
  609. distances between watermarks are 0.1% of the available memory in the
  610. node/system. The maximum value is 1000, or 10% of memory.
  611. A high rate of threads entering direct reclaim (allocstall) or kswapd
  612. going to sleep prematurely (kswapd_low_wmark_hit_quickly) can indicate
  613. that the number of free pages kswapd maintains for latency reasons is
  614. too small for the allocation bursts occurring in the system. This knob
  615. can then be used to tune kswapd aggressiveness accordingly.
  616. ==============================================================
  617. zone_reclaim_mode:
  618. Zone_reclaim_mode allows someone to set more or less aggressive approaches to
  619. reclaim memory when a zone runs out of memory. If it is set to zero then no
  620. zone reclaim occurs. Allocations will be satisfied from other zones / nodes
  621. in the system.
  622. This is value ORed together of
  623. 1 = Zone reclaim on
  624. 2 = Zone reclaim writes dirty pages out
  625. 4 = Zone reclaim swaps pages
  626. zone_reclaim_mode is disabled by default. For file servers or workloads
  627. that benefit from having their data cached, zone_reclaim_mode should be
  628. left disabled as the caching effect is likely to be more important than
  629. data locality.
  630. zone_reclaim may be enabled if it's known that the workload is partitioned
  631. such that each partition fits within a NUMA node and that accessing remote
  632. memory would cause a measurable performance reduction. The page allocator
  633. will then reclaim easily reusable pages (those page cache pages that are
  634. currently not used) before allocating off node pages.
  635. Allowing zone reclaim to write out pages stops processes that are
  636. writing large amounts of data from dirtying pages on other nodes. Zone
  637. reclaim will write out dirty pages if a zone fills up and so effectively
  638. throttle the process. This may decrease the performance of a single process
  639. since it cannot use all of system memory to buffer the outgoing writes
  640. anymore but it preserve the memory on other nodes so that the performance
  641. of other processes running on other nodes will not be affected.
  642. Allowing regular swap effectively restricts allocations to the local
  643. node unless explicitly overridden by memory policies or cpuset
  644. configurations.
  645. ============ End of Document =================================