===============================Documentation for /proc/sys/vm/=============================== kernel version 2.6.29 Copyright (c) 1998, 1999, Rik van Riel <riel@nl.linux.org> Copyright (c) 2008 Peter W. Morreale <pmorreale@novell.com> For general info and legal blurb, please look in index.rst. ------------------------------------------------------------------------------ This file contains the documentation for the sysctl files in/proc/sys/vm and is valid for Linux kernel version 2.6.29. The files in this directory can be used to tune the operationof the virtual memory (VM) subsystem of the Linux kernel andthe writeout of dirty data to disk. Currently, these files are in /proc/sys/vm: - admin_reserve_kbytes- compact_memory- compaction_proactiveness- compact_unevictable_allowed- defrag_mode- dirty_background_bytes- dirty_background_ratio- dirty_bytes- dirty_expire_centisecs- dirty_ratio- dirtytime_expire_seconds- dirty_writeback_centisecs- drop_caches- enable_soft_offline- extfrag_threshold- highmem_is_dirtyable- hugetlb_shm_group- legacy_va_layout- lowmem_reserve_ratio- max_map_count- mem_profiling (only if CONFIG_MEM_ALLOC_PROFILING=y)- memory_failure_early_kill- memory_failure_recovery- min_free_kbytes- min_slab_ratio- min_unmapped_ratio- mmap_min_addr- mmap_rnd_bits- mmap_rnd_compat_bits- movable_gigantic_pages- nr_hugepages- nr_hugepages_mempolicy- nr_overcommit_hugepages- nr_trim_pages (only if CONFIG_MMU=n)- numa_zonelist_order- oom_dump_tasks- oom_kill_allocating_task- overcommit_kbytes- overcommit_memory- overcommit_ratio- page-cluster- page_lock_unfairness- panic_on_oom- panic_on_unrecoverable_memory_failure- percpu_pagelist_high_fraction- stat_interval- stat_refresh- numa_stat- swappiness- unprivileged_userfaultfd- user_reserve_kbytes- vfs_cache_pressure- vfs_cache_pressure_denom- watermark_boost_factor- watermark_scale_factor- zone_reclaim_mode admin_reserve_kbytes==================== The amount of free memory in the system that should be reserved for userswith the capability cap_sys_admin. admin_reserve_kbytes defaults to min(3% of free pages, 8MB) That should provide enough for the admin to log in and kill a process,if necessary, under the default overcommit 'guess' mode. Systems running under overcommit 'never' should increase this to accountfor the full Virtual Memory Size of programs used to recover. Otherwise,root may not be able to log in to recover the system. How do you calculate a minimum useful reserve? sshd or login + bash (or some other shell) + top (or ps, kill, etc.) For overcommit 'guess', we can sum resident set sizes (RSS).On x86_64 this is about 8MB. For overcommit 'never', we can take the max of their virtual sizes (VSZ)and add the sum of their RSS.On x86_64 this is about 128MB. Changing this takes effect whenever an application requests memory. compact_memory============== Available only when CONFIG_COMPACTION is set. When 1 is written to the file,all zones are compacted such that free memory is available in contiguousblocks where possible. This can be important for example in the allocation ofhuge pages although processes will also directly compact memory as required. compaction_proactiveness======================== This tunable takes a value in the range [0, 100] with a default value of20. This tunable determines how aggressively compaction is done in thebackground. Write of a non zero value to this tunable will immediatelytrigger the proactive compaction. Setting it to 0 disables proactive compaction. Note that compaction has a non-trivial system-wide impact as pagesbelonging to different processes are moved around, which could also leadto latency spikes in unsuspecting applications. The kernel employsvarious heuristics to avoid wasting CPU cycles if it detects thatproactive compaction is not being effective. Setting the value above 80 will, in addition to lowering the acceptable levelof fragmentation, make the compaction code more sensitive to increases infragmentation, i.e. compaction will trigger more often, but reducefragmentation by a smaller amount.This makes the fragmentation level more stable over time. Be careful when setting it to extreme values like 100, as that maycause excessive background compaction activity. compact_unevictable_allowed=========================== Available only when CONFIG_COMPACTION is set. When set to 1, compaction isallowed to examine the unevictable lru (mlocked pages) for pages to compact.This should be used on systems where stalls for minor page faults are anacceptable trade for large contiguous free memory. Set to 0 to preventcompaction from moving pages that are unevictable. Default value is 1.On CONFIG_PREEMPT_RT the default value is 0 in order to avoid a page fault, dueto compaction, which would block the task from becoming active until the faultis resolved. defrag_mode=========== When set to 1, the page allocator tries harder to avoid fragmentationand maintain the ability to produce huge pages / higher-order pages. It is recommended to enable this right after boot, as fragmentation,once it occurred, can be long-lasting or even permanent. dirty_background_bytes====================== Contains the amount of dirty memory at which the background kernelflusher threads will start writeback. Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only one of them may be specified at a time. When one sysctl is written it is immediately taken into account to evaluate the dirty memory limits and the other appears as 0 when read. dirty_background_ratio====================== Contains, as a percentage of total available memory that contains free pagesand reclaimable pages, the number of pages at which the background kernelflusher threads will start writing out dirty data. The total available memory is not equal to total system memory. dirty_bytes=========== Contains the amount of dirty memory at which a process generating disk writeswill itself start writeback. Note: dirty_bytes is the counterpart of dirty_ratio. Only one of them may bespecified at a time. When one sysctl is written it is immediately taken intoaccount to evaluate the dirty memory limits and the other appears as 0 whenread. Note: the minimum value allowed for dirty_bytes is two pages (in bytes); anyvalue lower than this limit will be ignored and the old configuration will beretained. dirty_expire_centisecs====================== This tunable is used to define when dirty data is old enough to be eligiblefor writeout by the kernel flusher threads. It is expressed in 100'thsof a second. Data which has been dirty in-memory for longer than thisinterval will be written out next time a flusher thread wakes up. dirty_ratio=========== Contains, as a percentage of total available memory that contains free pagesand reclaimable pages, the number of pages at which a process which isgenerating disk writes will itself start writing out dirty data. The total available memory is not equal to total system memory. dirtytime_expire_seconds======================== When a lazytime inode is constantly having its pages dirtied, the inode withan updated timestamp will never get chance to be written out. And, if theonly thing that has happened on the file system is a dirtytime inode causedby an atime update, a worker will be scheduled to make sure that inodeeventually gets pushed out to disk. This tunable is used to define when dirtyinode is old enough to be eligible for writeback by the kernel flusher threads.And, it is also used as the interval to wakeup dirtytime_writeback thread. Setting this to zero disables periodic dirtytime writeback. dirty_writeback_centisecs========================= The kernel flusher threads will periodically wake up and write `old` dataout to disk. This tunable expresses the interval between those wakeups, in100'ths of a second. Setting this to zero disables periodic writeback altogether. drop_caches=========== Writing to this will cause the kernel to drop clean caches, as well asreclaimable slab objects like dentries and inodes. Once dropped, theirmemory becomes free. To free pagecache:: echo 1 > /proc/sys/vm/drop_caches To free reclaimable slab objects (includes dentries and inodes):: echo 2 > /proc/sys/vm/drop_caches To free slab objects and pagecache:: echo 3 > /proc/sys/vm/drop_caches This is a non-destructive operation and will not free any dirty objects.To increase the number of objects freed by this operation, the user may run`sync` prior to writing to /proc/sys/vm/drop_caches. This will minimize thenumber of dirty objects on the system and create more candidates to bedropped. This file is not a means to control the growth of the various kernel caches(inodes, dentries, pagecache, etc...) These objects are automaticallyreclaimed by the kernel when memory is needed elsewhere on the system. Use of this file can cause performance problems. Since it discards cachedobjects, it may cost a significant amount of I/O and CPU to recreate thedropped objects, especially if they were under heavy use. Because of this,use outside of a testing or debugging environment is not recommended. You may see informational messages in your kernel log when this file isused:: cat (1234): drop_caches: 3 These are informational only. They do not mean that anything is wrongwith your system. To disable them, echo 4 (bit 2) into drop_caches. enable_soft_offline===================Correctable memory errors are very common on servers. Soft-offline is kernel'ssolution for memory pages having (excessive) corrected memory errors. For different types of page, soft-offline has different behaviors / costs. - For a raw error page, soft-offline migrates the in-use page's content to a new raw page. - For a page that is part of a transparent hugepage, soft-offline splits the transparent hugepage into raw pages, then migrates only the raw error page. As a result, user is transparently backed by 1 less hugepage, impacting memory access performance. - For a page that is part of a HugeTLB hugepage, soft-offline first migrates the entire HugeTLB hugepage, during which a free hugepage will be consumed as migration target. Then the original hugepage is dissolved into raw pages without compensation, reducing the capacity of the HugeTLB pool by 1. It is user's call to choose between reliability (staying away from fragilephysical memory) vs performance / capacity implications in transparent andHugeTLB cases. For all architectures, enable_soft_offline controls whether to soft offlinememory pages. When set to 1, kernel attempts to soft offline the pageswhenever it thinks needed. When set to 0, kernel returns EOPNOTSUPP tothe request to soft offline the pages. Its default value is 1. It is worth mentioning that after setting enable_soft_offline to 0, thefollowing requests to soft offline pages will not be performed: - Request to soft offline pages from RAS Correctable Errors Collector. - On ARM, the request to soft offline pages from GHES driver. - On PARISC, the request to soft offline pages from Page Deallocation Table. extfrag_threshold================= This parameter affects whether the kernel will compact memory or directreclaim to satisfy a high-order allocation. The extfrag/extfrag_index file indebugfs shows what the fragmentation index for each order is in each zone inthe system. Values tending towards 0 imply allocations would fail due to lackof memory, values towards 1000 imply failures are due to fragmentation and -1implies that the allocation will succeed as long as watermarks are met. The kernel will not compact memory in a zone if thefragmentation index is <= extfrag_threshold. The default value is 500. highmem_is_dirtyable==================== Available only for systems with CONFIG_HIGHMEM enabled (32b systems). This parameter controls whether the high memory is considered for dirtywriters throttling. This is not the case by default which means thatonly the amount of memory directly visible/usable by the kernel canbe dirtied. As a result, on systems with a large amount of memory andlowmem basically depleted writers might be throttled too early andstreaming writes can get very slow. Changing the value to non zero would allow more memory to be dirtiedand thus allow writers to write more data which can be flushed to thestorage more effectively. Note this also comes with a risk of pre-matureOOM killer because some writers (e.g. direct block device writes) canonly use the low memory and they can fill it up with dirty data withoutany throttling. hugetlb_shm_group================= hugetlb_shm_group contains group id that is allowed to create SysVshared memory segment using hugetlb page. legacy_va_layout================ If non-zero, this sysctl disables the new 32-bit mmap layout - the kernelwill use the legacy (2.4) layout for all processes. lowmem_reserve_ratio==================== For some specialised workloads on highmem machines it is dangerous forthe kernel to allow process memory to be allocated from the "lowmem"zone. This is because that memory could then be pinned via the mlock()system call, or by unavailability of swapspace. And on large highmem machines this lack of reclaimable lowmem memorycan be fatal. So the Linux page allocator has a mechanism which prevents allocationswhich *could* use highmem from using too much lowmem. This means thata certain amount of lowmem is defended from the possibility of beingcaptured into pinned user memory. (The same argument applies to the old 16 megabyte ISA DMA region. Thismechanism will also defend that region from allocations which could usehighmem or lowmem). The `lowmem_reserve_ratio` tunable determines how aggressive the kernel isin defending these lower zones. If you have a machine which uses highmem or ISA DMA and yourapplications are using mlock(), or if you are running with no swap thenyou probably should change the lowmem_reserve_ratio setting. The lowmem_reserve_ratio is an array. You can see them by reading this file:: % cat /proc/sys/vm/lowmem_reserve_ratio 256 256 32 But, these values are not used directly. The kernel calculates # of protectionpages for each zones from them. These are shown as array of protection pagesin /proc/zoneinfo like the following. (This is an example of x86-64 box).Each zone has an array of protection pages like this:: Node 0, zone DMA pages free 1355 min 3 low 3 high 4 : : numa_other 0 protection: (0, 2004, 2004, 2004) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pagesets cpu: 0 pcp: 0 : These protections are added to score to judge whether this zone should be usedfor page allocation or should be reclaimed. In this example, if normal pages (index=2) are required to this DMA zone andwatermark[WMARK_HIGH] is used for watermark, the kernel judges this zone shouldnot be used because pages_free(1355) is smaller than watermark + protection[2](4 + 2004 = 2008). If this protection value is 0, this zone would be used fornormal page requirement. If requirement is DMA zone(index=0), protection[0](=0) is used. zone[i]'s protection[j] is calculated by following expression:: (i < j): zone[i]->protection[j] = (total sums of managed_pages from zone[i+1] to zone[j] on the node) / lowmem_reserve_ratio[i]; (i = j): (should not be protected. = 0; (i > j): (not necessary, but looks 0) The default values of lowmem_reserve_ratio[i] are === ==================================== 256 (if zone[i] means DMA or DMA32 zone) 32 (others) === ==================================== As above expression, they are reciprocal number of ratio.256 means 1/256. # of protection pages becomes about "0.39%" of total managedpages of higher zones on the node. If you would like to protect more pages, smaller values are effective.The minimum value is 1 (1/1 -> 100%). The value less than 1 completelydisables protection of the pages. max_map_count============= This file contains the maximum number of memory map areas a processmay have. Memory map areas are used as a side-effect of callingmalloc, directly by mmap, mprotect, and madvise, and also when loadingshared libraries. While most applications need less than a thousand maps, certainprograms, particularly malloc debuggers, may consume lots of them,e.g., up to one or two maps per allocation. The default value is 65530. mem_profiling============== Enable memory profiling (when CONFIG_MEM_ALLOC_PROFILING=y) 1: Enable memory profiling. 0: Disable memory profiling. Enabling memory profiling introduces a small performance overhead for allmemory allocations. The default value depends on CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT. When CONFIG_MEM_ALLOC_PROFILING_DEBUG=y, this control is read-only to avoidwarnings produced by allocations made while profiling is disabled and freedwhen it's enabled. memory_failure_early_kill========================= Control how to kill processes when uncorrected memory error (typicallya 2bit error in a memory module) is detected in the background by hardwarethat cannot be handled by the kernel. In some cases (like the pageLines 1–500 of 1230. Load more
=============================== Documentation for /proc/sys/vm/ =============================== kernel version 2.6.29 Copyright (c) 1998, 1999, Rik van Riel <riel@nl.linux.org> Copyright (c) 2008 Peter W. Morreale <pmorreale@novell.com> For general info and legal blurb, please look in index.rst. ------------------------------------------------------------------------------ This file contains the documentation for the sysctl files in /proc/sys/vm and is valid for Linux kernel version 2.6.29. The files in this directory can be used to tune the operation of the virtual memory (VM) subsystem of the Linux kernel and the writeout of dirty data to disk. Currently, these files are in /proc/sys/vm: - admin_reserve_kbytes - compact_memory - compaction_proactiveness - compact_unevictable_allowed - defrag_mode - dirty_background_bytes - dirty_background_ratio - dirty_bytes - dirty_expire_centisecs - dirty_ratio - dirtytime_expire_seconds - dirty_writeback_centisecs - drop_caches - enable_soft_offline - extfrag_threshold - highmem_is_dirtyable - hugetlb_shm_group - legacy_va_layout - lowmem_reserve_ratio - max_map_count - mem_profiling (only if CONFIG_MEM_ALLOC_PROFILING=y) - memory_failure_early_kill - memory_failure_recovery - min_free_kbytes - min_slab_ratio - min_unmapped_ratio - mmap_min_addr - mmap_rnd_bits - mmap_rnd_compat_bits - movable_gigantic_pages - nr_hugepages - nr_hugepages_mempolicy - nr_overcommit_hugepages - nr_trim_pages (only if CONFIG_MMU=n) - numa_zonelist_order - oom_dump_tasks - oom_kill_allocating_task - overcommit_kbytes - overcommit_memory - overcommit_ratio - page-cluster - page_lock_unfairness - panic_on_oom - panic_on_unrecoverable_memory_failure - percpu_pagelist_high_fraction - stat_interval - stat_refresh - numa_stat - swappiness - unprivileged_userfaultfd - user_reserve_kbytes - vfs_cache_pressure - vfs_cache_pressure_denom - watermark_boost_factor - watermark_scale_factor - zone_reclaim_mode admin_reserve_kbytes ==================== The amount of free memory in the system that should be reserved for users with the capability cap_sys_admin. admin_reserve_kbytes defaults to min(3% of free pages, 8MB) That should provide enough for the admin to log in and kill a process, if necessary, under the default overcommit 'guess' mode. Systems running under overcommit 'never' should increase this to account for the full Virtual Memory Size of programs used to recover. Otherwise, root may not be able to log in to recover the system. How do you calculate a minimum useful reserve? sshd or login + bash (or some other shell) + top (or ps, kill, etc.) For overcommit 'guess', we can sum resident set sizes (RSS). On x86_64 this is about 8MB. For overcommit 'never', we can take the max of their virtual sizes (VSZ) and add the sum of their RSS. On x86_64 this is about 128MB. Changing this takes effect whenever an application requests memory. compact_memory ============== Available only when CONFIG_COMPACTION is set. When 1 is written to the file, all zones are compacted such that free memory is available in contiguous blocks where possible. This can be important for example in the allocation of huge pages although processes will also directly compact memory as required. compaction_proactiveness ======================== This tunable takes a value in the range [0, 100] with a default value of 20. This tunable determines how aggressively compaction is done in the background. Write of a non zero value to this tunable will immediately trigger the proactive compaction. Setting it to 0 disables proactive compaction. Note that compaction has a non-trivial system-wide impact as pages belonging to different processes are moved around, which could also lead to latency spikes in unsuspecting applications. The kernel employs various heuristics to avoid wasting CPU cycles if it detects that proactive compaction is not being effective. Setting the value above 80 will, in addition to lowering the acceptable level of fragmentation, make the compaction code more sensitive to increases in fragmentation, i.e. compaction will trigger more often, but reduce fragmentation by a smaller amount. This makes the fragmentation level more stable over time. Be careful when setting it to extreme values like 100, as that may cause excessive background compaction activity. compact_unevictable_allowed =========================== Available only when CONFIG_COMPACTION is set. When set to 1, compaction is allowed to examine the unevictable lru (mlocked pages) for pages to compact. This should be used on systems where stalls for minor page faults are an acceptable trade for large contiguous free memory. Set to 0 to prevent compaction from moving pages that are unevictable. Default value is 1. On CONFIG_PREEMPT_RT the default value is 0 in order to avoid a page fault, due to compaction, which would block the task from becoming active until the fault is resolved. defrag_mode =========== When set to 1, the page allocator tries harder to avoid fragmentation and maintain the ability to produce huge pages / higher-order pages. It is recommended to enable this right after boot, as fragmentation, once it occurred, can be long-lasting or even permanent. dirty_background_bytes ====================== Contains the amount of dirty memory at which the background kernel flusher threads will start writeback. Note: dirty_background_bytes is the counterpart of dirty_background_ratio. Only one of them may be specified at a time. When one sysctl is written it is immediately taken into account to evaluate the dirty memory limits and the other appears as 0 when read. dirty_background_ratio ====================== Contains, as a percentage of total available memory that contains free pages and reclaimable pages, the number of pages at which the background kernel flusher threads will start writing out dirty data. The total available memory is not equal to total system memory. dirty_bytes =========== Contains the amount of dirty memory at which a process generating disk writes will itself start writeback. Note: dirty_bytes is the counterpart of dirty_ratio. Only one of them may be specified at a time. When one sysctl is written it is immediately taken into account to evaluate the dirty memory limits and the other appears as 0 when read. Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any value lower than this limit will be ignored and the old configuration will be retained. dirty_expire_centisecs ====================== This tunable is used to define when dirty data is old enough to be eligible for writeout by the kernel flusher threads. It is expressed in 100'ths of a second. Data which has been dirty in-memory for longer than this interval will be written out next time a flusher thread wakes up. dirty_ratio =========== Contains, as a percentage of total available memory that contains free pages and reclaimable pages, the number of pages at which a process which is generating disk writes will itself start writing out dirty data. The total available memory is not equal to total system memory. dirtytime_expire_seconds ======================== When a lazytime inode is constantly having its pages dirtied, the inode with an updated timestamp will never get chance to be written out. And, if the only thing that has happened on the file system is a dirtytime inode caused by an atime update, a worker will be scheduled to make sure that inode eventually gets pushed out to disk. This tunable is used to define when dirty inode is old enough to be eligible for writeback by the kernel flusher threads. And, it is also used as the interval to wakeup dirtytime_writeback thread. Setting this to zero disables periodic dirtytime writeback. dirty_writeback_centisecs ========================= The kernel flusher threads will periodically wake up and write `old` data out to disk. This tunable expresses the interval between those wakeups, in 100'ths of a second. Setting this to zero disables periodic writeback altogether. drop_caches =========== Writing to this will cause the kernel to drop clean caches, as well as reclaimable slab objects like dentries and inodes. Once dropped, their memory becomes free. To free pagecache:: echo 1 > /proc/sys/vm/drop_caches To free reclaimable slab objects (includes dentries and inodes):: echo 2 > /proc/sys/vm/drop_caches To free slab objects and pagecache:: echo 3 > /proc/sys/vm/drop_caches This is a non-destructive operation and will not free any dirty objects. To increase the number of objects freed by this operation, the user may run `sync` prior to writing to /proc/sys/vm/drop_caches. This will minimize the number of dirty objects on the system and create more candidates to be dropped. This file is not a means to control the growth of the various kernel caches (inodes, dentries, pagecache, etc...) These objects are automatically reclaimed by the kernel when memory is needed elsewhere on the system. Use of this file can cause performance problems. Since it discards cached objects, it may cost a significant amount of I/O and CPU to recreate the dropped objects, especially if they were under heavy use. Because of this, use outside of a testing or debugging environment is not recommended. You may see informational messages in your kernel log when this file is used:: cat (1234): drop_caches: 3 These are informational only. They do not mean that anything is wrong with your system. To disable them, echo 4 (bit 2) into drop_caches. enable_soft_offline =================== Correctable memory errors are very common on servers. Soft-offline is kernel's solution for memory pages having (excessive) corrected memory errors. For different types of page, soft-offline has different behaviors / costs. - For a raw error page, soft-offline migrates the in-use page's content to a new raw page. - For a page that is part of a transparent hugepage, soft-offline splits the transparent hugepage into raw pages, then migrates only the raw error page. As a result, user is transparently backed by 1 less hugepage, impacting memory access performance. - For a page that is part of a HugeTLB hugepage, soft-offline first migrates the entire HugeTLB hugepage, during which a free hugepage will be consumed as migration target. Then the original hugepage is dissolved into raw pages without compensation, reducing the capacity of the HugeTLB pool by 1. It is user's call to choose between reliability (staying away from fragile physical memory) vs performance / capacity implications in transparent and HugeTLB cases. For all architectures, enable_soft_offline controls whether to soft offline memory pages. When set to 1, kernel attempts to soft offline the pages whenever it thinks needed. When set to 0, kernel returns EOPNOTSUPP to the request to soft offline the pages. Its default value is 1. It is worth mentioning that after setting enable_soft_offline to 0, the following requests to soft offline pages will not be performed: - Request to soft offline pages from RAS Correctable Errors Collector. - On ARM, the request to soft offline pages from GHES driver. - On PARISC, the request to soft offline pages from Page Deallocation Table. extfrag_threshold ================= This parameter affects whether the kernel will compact memory or direct reclaim to satisfy a high-order allocation. The extfrag/extfrag_index file in debugfs shows what the fragmentation index for each order is in each zone in the system. Values tending towards 0 imply allocations would fail due to lack of memory, values towards 1000 imply failures are due to fragmentation and -1 implies that the allocation will succeed as long as watermarks are met. The kernel will not compact memory in a zone if the fragmentation index is <= extfrag_threshold. The default value is 500. highmem_is_dirtyable ==================== Available only for systems with CONFIG_HIGHMEM enabled (32b systems). This parameter controls whether the high memory is considered for dirty writers throttling. This is not the case by default which means that only the amount of memory directly visible/usable by the kernel can be dirtied. As a result, on systems with a large amount of memory and lowmem basically depleted writers might be throttled too early and streaming writes can get very slow. Changing the value to non zero would allow more memory to be dirtied and thus allow writers to write more data which can be flushed to the storage more effectively. Note this also comes with a risk of pre-mature OOM killer because some writers (e.g. direct block device writes) can only use the low memory and they can fill it up with dirty data without any throttling. hugetlb_shm_group ================= hugetlb_shm_group contains group id that is allowed to create SysV shared memory segment using hugetlb page. legacy_va_layout ================ If non-zero, this sysctl disables the new 32-bit mmap layout - the kernel will use the legacy (2.4) layout for all processes. lowmem_reserve_ratio ==================== For some specialised workloads on highmem machines it is dangerous for the kernel to allow process memory to be allocated from the "lowmem" zone. This is because that memory could then be pinned via the mlock() system call, or by unavailability of swapspace. And on large highmem machines this lack of reclaimable lowmem memory can be fatal. So the Linux page allocator has a mechanism which prevents allocations which *could* use highmem from using too much lowmem. This means that a certain amount of lowmem is defended from the possibility of being captured into pinned user memory. (The same argument applies to the old 16 megabyte ISA DMA region. This mechanism will also defend that region from allocations which could use highmem or lowmem). The `lowmem_reserve_ratio` tunable determines how aggressive the kernel is in defending these lower zones. If you have a machine which uses highmem or ISA DMA and your applications are using mlock(), or if you are running with no swap then you probably should change the lowmem_reserve_ratio setting. The lowmem_reserve_ratio is an array. You can see them by reading this file:: % cat /proc/sys/vm/lowmem_reserve_ratio 256 256 32 But, these values are not used directly. The kernel calculates # of protection pages for each zones from them. These are shown as array of protection pages in /proc/zoneinfo like the following. (This is an example of x86-64 box). Each zone has an array of protection pages like this:: Node 0, zone DMA pages free 1355 min 3 low 3 high 4 : : numa_other 0 protection: (0, 2004, 2004, 2004) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pagesets cpu: 0 pcp: 0 : These protections are added to score to judge whether this zone should be used for page allocation or should be reclaimed. In this example, if normal pages (index=2) are required to this DMA zone and watermark[WMARK_HIGH] is used for watermark, the kernel judges this zone should not be used because pages_free(1355) is smaller than watermark + protection[2] (4 + 2004 = 2008). If this protection value is 0, this zone would be used for normal page requirement. If requirement is DMA zone(index=0), protection[0] (=0) is used. zone[i]'s protection[j] is calculated by following expression:: (i < j): zone[i]->protection[j] = (total sums of managed_pages from zone[i+1] to zone[j] on the node) / lowmem_reserve_ratio[i]; (i = j): (should not be protected. = 0; (i > j): (not necessary, but looks 0) The default values of lowmem_reserve_ratio[i] are === ==================================== 256 (if zone[i] means DMA or DMA32 zone) 32 (others) === ==================================== As above expression, they are reciprocal number of ratio. 256 means 1/256. # of protection pages becomes about "0.39%" of total managed pages of higher zones on the node. If you would like to protect more pages, smaller values are effective. The minimum value is 1 (1/1 -> 100%). The value less than 1 completely disables protection of the pages. max_map_count ============= This file contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap, mprotect, and madvise, and also when loading shared libraries. While most applications need less than a thousand maps, certain programs, particularly malloc debuggers, may consume lots of them, e.g., up to one or two maps per allocation. The default value is 65530. mem_profiling ============== Enable memory profiling (when CONFIG_MEM_ALLOC_PROFILING=y) 1: Enable memory profiling. 0: Disable memory profiling. Enabling memory profiling introduces a small performance overhead for all memory allocations. The default value depends on CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT. When CONFIG_MEM_ALLOC_PROFILING_DEBUG=y, this control is read-only to avoid warnings produced by allocations made while profiling is disabled and freed when it's enabled. memory_failure_early_kill ========================= Control how to kill processes when uncorrected memory error (typically a 2bit error in a memory module) is detected in the background by hardware that cannot be handled by the kernel. In some cases (like the page