vm.txt 34 KB

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