vm.txt 32 KB

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