sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/admin-guide/cgroup-v1/memorymodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hMemory Resource Controllerh]hMemory Resource Controller}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/admin-guide/cgroup-v1/memory.rsthKubhcaution)}(hThis document is hopelessly outdated and it asks for a complete rewrite. It still contains a useful information so we are keeping it here but make sure to check the current code if you need a deeper understanding.h]h paragraph)}(hThis document is hopelessly outdated and it asks for a complete rewrite. It still contains a useful information so we are keeping it here but make sure to check the current code if you need a deeper understanding.h]hThis document is hopelessly outdated and it asks for a complete rewrite. It still contains a useful information so we are keeping it here but make sure to check the current code if you need a deeper understanding.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubhnote)}(hThe Memory Resource Controller has generically been referred to as the memory controller in this document. Do not confuse memory controller used here with the memory controller that is used in hardware.h]h)}(hThe Memory Resource Controller has generically been referred to as the memory controller in this document. Do not confuse memory controller used here with the memory controller that is used in hardware.h]hThe Memory Resource Controller has generically been referred to as the memory controller in this document. Do not confuse memory controller used here with the memory controller that is used in hardware.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubhhint)}(hWhen we mention a cgroup (cgroupfs's directory) with memory controller, we call it "memory cgroup". When you see git-log and source code, you'll see patch's title and function names tend to use "memcg". In this document, we avoid using it.h]h)}(hWhen we mention a cgroup (cgroupfs's directory) with memory controller, we call it "memory cgroup". When you see git-log and source code, you'll see patch's title and function names tend to use "memcg". In this document, we avoid using it.h]hWhen we mention a cgroup (cgroupfs’s directory) with memory controller, we call it “memory cgroup”. When you see git-log and source code, you’ll see patch’s title and function names tend to use “memcg”. In this document, we avoid using it.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhNubh)}(hhh](h)}(h-Benefits and Purpose of the memory controllerh]h-Benefits and Purpose of the memory controller}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hThe memory controller isolates the memory behaviour of a group of tasks from the rest of the system. The article on LWN [12]_ mentions some probable uses of the memory controller. The memory controller can be used toh](hxThe memory controller isolates the memory behaviour of a group of tasks from the rest of the system. The article on LWN }(hjhhhNhNubhfootnote_reference)}(h[12]_h]h12}(hj"hhhNhNubah}(h]id1ah ]h"]h$]h&]refidid14docnameadmin-guide/cgroup-v1/memoryuh1j hjresolvedKubh[ mentions some probable uses of the memory controller. The memory controller can be used to}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhenumerated_list)}(hhh](h list_item)}(hIsolate an application or a group of applications Memory-hungry applications can be isolated and limited to a smaller amount of memory.h]h)}(hIsolate an application or a group of applications Memory-hungry applications can be isolated and limited to a smaller amount of memory.h]hIsolate an application or a group of applications Memory-hungry applications can be isolated and limited to a smaller amount of memory.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjGubah}(h]h ]h"]h$]h&]uh1jEhjBhhhhhNubjF)}(hqCreate a cgroup with a limited amount of memory; this can be used as a good alternative to booting with mem=XXXX.h]h)}(hqCreate a cgroup with a limited amount of memory; this can be used as a good alternative to booting with mem=XXXX.h]hqCreate a cgroup with a limited amount of memory; this can be used as a good alternative to booting with mem=XXXX.}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hj_ubah}(h]h ]h"]h$]h&]uh1jEhjBhhhhhNubjF)}(hlVirtualization solutions can control the amount of memory they want to assign to a virtual machine instance.h]h)}(hlVirtualization solutions can control the amount of memory they want to assign to a virtual machine instance.h]hlVirtualization solutions can control the amount of memory they want to assign to a virtual machine instance.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjwubah}(h]h ]h"]h$]h&]uh1jEhjBhhhhhNubjF)}(hA CD/DVD burner could control the amount of memory used by the rest of the system to ensure that burning does not fail due to lack of available memory.h]h)}(hA CD/DVD burner could control the amount of memory used by the rest of the system to ensure that burning does not fail due to lack of available memory.h]hA CD/DVD burner could control the amount of memory used by the rest of the system to ensure that burning does not fail due to lack of available memory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjubah}(h]h ]h"]h$]h&]uh1jEhjBhhhhhNubjF)}(hxThere are several other use cases; find one or use the controller just for fun (to learn and hack on the VM subsystem). h]h)}(hwThere are several other use cases; find one or use the controller just for fun (to learn and hack on the VM subsystem).h]hwThere are several other use cases; find one or use the controller just for fun (to learn and hack on the VM subsystem).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jEhjBhhhhhNubeh}(h]h ]h"]h$]h&]enumtype loweralphaprefixhsuffix.uh1j@hjhhhhhKubh)}(hECurrent Status: linux-2.6.34-mmotm(development version of 2010/April)h]hECurrent Status: linux-2.6.34-mmotm(development version of 2010/April)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjhhubh)}(h Features:h]h Features:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjhhubh block_quote)}(hXk- accounting anonymous pages, file caches, swap caches usage and limiting them. - pages are linked to per-memcg LRU exclusively, and there is no global LRU. - optionally, memory+swap usage can be accounted and limited. - hierarchical accounting - soft limit - moving (recharging) account at moving a task is selectable. - usage threshold notifier - memory pressure notifier - oom-killer disable knob and oom-notifier - Root cgroup has no limit controls. Kernel memory support is a work in progress, and the current version provides basically functionality. (See :ref:`section 2.7 `) h](h bullet_list)}(hhh](jF)}(hMaccounting anonymous pages, file caches, swap caches usage and limiting them.h]h)}(hjh]hMaccounting anonymous pages, file caches, swap caches usage and limiting them.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(hJpages are linked to per-memcg LRU exclusively, and there is no global LRU.h]h)}(hj h]hJpages are linked to per-memcg LRU exclusively, and there is no global LRU.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h;optionally, memory+swap usage can be accounted and limited.h]h)}(hj!h]h;optionally, memory+swap usage can be accounted and limited.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(hhierarchical accountingh]h)}(hj8h]hhierarchical accounting}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hj6ubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h soft limith]h)}(hjOh]h soft limit}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjMubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h;moving (recharging) account at moving a task is selectable.h]h)}(hjfh]h;moving (recharging) account at moving a task is selectable.}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjdubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(husage threshold notifierh]h)}(hj}h]husage threshold notifier}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hj{ubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(hmemory pressure notifierh]h)}(hjh]hmemory pressure notifier}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h(oom-killer disable knob and oom-notifierh]h)}(hjh]h(oom-killer disable knob and oom-notifier}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h#Root cgroup has no limit controls. h]h)}(h"Root cgroup has no limit controls.h]h"Root cgroup has no limit controls.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hjubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhK.hjubh)}(hKernel memory support is a work in progress, and the current version provides basically functionality. (See :ref:`section 2.7 `)h](hlKernel memory support is a work in progress, and the current version provides basically functionality. (See }(hjhhhNhNubh)}(h6:ref:`section 2.7 `h]hinline)}(hjh]h section 2.7}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj4 refdomainjreftyperef refexplicitrefwarn reftarget!cgroup-v1-memory-kernel-extensionuh1hhhhK9hjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjubeh}(h]h ]h"]h$]h&]uh1jhhhK.hjhhubh)}(hBrief summary of control files.h]hBrief summary of control files.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjhhubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK$uh1j4hj1ubj5)}(hhh]h}(h]h ]h"]h$]h&]colwidthK8uh1j4hj1ubhtbody)}(hhh](hrow)}(hhh](hentry)}(hhh]h)}(htasksh]htasks}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjVubah}(h]h ]h"]h$]h&]uh1jThjQubjU)}(hhh]h)}(h.attach a task(thread) and show list of threadsh]h.attach a task(thread) and show list of threads}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjmubah}(h]h ]h"]h$]h&]uh1jThjQubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(h cgroup.procsh]h cgroup.procs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hshow list of processesh]hshow list of processes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hcgroup.event_controlh]hcgroup.event_control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKChjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hTan interface for event_fd() This knob is not available on CONFIG_PREEMPT_RT systems.h]hTan interface for event_fd() This knob is not available on CONFIG_PREEMPT_RT systems.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKChjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.usage_in_bytesh]hmemory.usage_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h3show current usage for memory (See 5.5 for details)h]h3show current usage for memory (See 5.5 for details)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.memsw.usage_in_bytesh]hmemory.memsw.usage_in_bytes}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhj2ubah}(h]h ]h"]h$]h&]uh1jThj/ubjU)}(hhh]h)}(h8show current usage for memory+Swap (See 5.5 for details)h]h8show current usage for memory+Swap (See 5.5 for details)}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjIubah}(h]h ]h"]h$]h&]uh1jThj/ubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.limit_in_bytesh]hmemory.limit_in_bytes}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjiubah}(h]h ]h"]h$]h&]uh1jThjfubjU)}(hhh]h)}(hset/show limit of memory usageh]hset/show limit of memory usage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjubah}(h]h ]h"]h$]h&]uh1jThjfubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.memsw.limit_in_bytesh]hmemory.memsw.limit_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h#set/show limit of memory+Swap usageh]h#set/show limit of memory+Swap usage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.failcnth]hmemory.failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h+show the number of memory usage hits limitsh]h+show the number of memory usage hits limits}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.memsw.failcnth]hmemory.memsw.failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1jThj ubjU)}(hhh]h)}(h*show the number of memory+Swap hits limitsh]h*show the number of memory+Swap hits limits}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhj%ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.max_usage_in_bytesh]hmemory.max_usage_in_bytes}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjEubah}(h]h ]h"]h$]h&]uh1jThjBubjU)}(hhh]h)}(hshow max memory usage recordedh]hshow max memory usage recorded}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhj\ubah}(h]h ]h"]h$]h&]uh1jThjBubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.memsw.max_usage_in_bytesh]hmemory.memsw.max_usage_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhj|ubah}(h]h ]h"]h$]h&]uh1jThjyubjU)}(hhh]h)}(h#show max memory+Swap usage recordedh]h#show max memory+Swap usage recorded}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1jThjyubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.soft_limit_in_bytesh]hmemory.soft_limit_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hset/show soft limit of memory usage This knob is not available on CONFIG_PREEMPT_RT systems. This knob is deprecated and shouldn't be used.h]hset/show soft limit of memory usage This knob is not available on CONFIG_PREEMPT_RT systems. This knob is deprecated and shouldn’t be used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKOhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(h memory.stath]h memory.stat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hshow various statisticsh]hshow various statistics}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKShjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.use_hierarchyh]hmemory.use_hierarchy}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThj!ubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hTset/show hierarchical account enabled This knob is deprecated and shouldn't be used.h]hVset/show hierarchical account enabled This knob is deprecated and shouldn’t be used.}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThj8ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.force_emptyh]hmemory.force_empty}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjXubah}(h]h ]h"]h$]h&]uh1jThjUubjU)}(hhh]h)}(htrigger forced page reclaimh]htrigger forced page reclaim}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjoubah}(h]h ]h"]h$]h&]uh1jThjUubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.pressure_levelh]hmemory.pressure_level}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hPset memory pressure notifications This knob is deprecated and shouldn't be used.h]hRset memory pressure notifications This knob is deprecated and shouldn’t be used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.swappinessh]hmemory.swappiness}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hpset/show swappiness parameter of vmscan (See sysctl's vm.swappiness) Per memcg knob does not exist in cgroup v2.h]hrset/show swappiness parameter of vmscan (See sysctl’s vm.swappiness) Per memcg knob does not exist in cgroup v2.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.move_charge_at_immigrateh]hmemory.move_charge_at_immigrate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hThis knob is deprecated.h]hThis knob is deprecated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.oom_controlh]hmemory.oom_control}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hj4ubah}(h]h ]h"]h$]h&]uh1jThj1ubjU)}(hhh]h)}(hEset/show oom controls. This knob is deprecated and shouldn't be used.h]hGset/show oom controls. This knob is deprecated and shouldn’t be used.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjKubah}(h]h ]h"]h$]h&]uh1jThj1ubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.numa_stath]hmemory.numa_stat}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjkubah}(h]h ]h"]h$]h&]uh1jThjhubjU)}(hhh]h)}(h-show the number of memory usage per numa nodeh]h-show the number of memory usage per numa node}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhjubah}(h]h ]h"]h$]h&]uh1jThjhubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.limit_in_bytesh]hmemory.kmem.limit_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hXDeprecated knob to set and read the kernel memory hard limit. Kernel hard limit is not supported since 5.16. Writing any value to do file will not have any effect same as if nokmem kernel parameter was specified. Kernel memory is still charged and reported by memory.kmem.usage_in_bytes.h]hXDeprecated knob to set and read the kernel memory hard limit. Kernel hard limit is not supported since 5.16. Writing any value to do file will not have any effect same as if nokmem kernel parameter was specified. Kernel memory is still charged and reported by memory.kmem.usage_in_bytes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKdhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.usage_in_bytesh]hmemory.kmem.usage_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h%show current kernel memory allocationh]h%show current kernel memory allocation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.failcnth]hmemory.kmem.failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhjubah}(h]h ]h"]h$]h&]uh1jThj ubjU)}(hhh]h)}(h2show the number of kernel memory usage hits limitsh]h2show the number of kernel memory usage hits limits}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhj'ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.max_usage_in_bytesh]hmemory.kmem.max_usage_in_bytes}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjGubah}(h]h ]h"]h$]h&]uh1jThjDubjU)}(hhh]h)}(h%show max kernel memory usage recordedh]h%show max kernel memory usage recorded}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhj^ubah}(h]h ]h"]h$]h&]uh1jThjDubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.tcp.limit_in_bytesh]hmemory.kmem.tcp.limit_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKphj~ubah}(h]h ]h"]h$]h&]uh1jThj{ubjU)}(hhh]h)}(hUset/show hard limit for tcp buf memory This knob is deprecated and shouldn't be used.h]hWset/show hard limit for tcp buf memory This knob is deprecated and shouldn’t be used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKphjubah}(h]h ]h"]h$]h&]uh1jThj{ubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.tcp.usage_in_bytesh]hmemory.kmem.tcp.usage_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hUshow current tcp buf memory allocation This knob is deprecated and shouldn't be used.h]hWshow current tcp buf memory allocation This knob is deprecated and shouldn’t be used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(hmemory.kmem.tcp.failcnth]hmemory.kmem.tcp.failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hbshow the number of tcp buf memory usage hits limits This knob is deprecated and shouldn't be used.h]hdshow the number of tcp buf memory usage hits limits This knob is deprecated and shouldn’t be used.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhj ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjLubjP)}(hhh](jU)}(hhh]h)}(h"memory.kmem.tcp.max_usage_in_bytesh]h"memory.kmem.tcp.max_usage_in_bytes}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhj# ubah}(h]h ]h"]h$]h&]uh1jThj ubjU)}(hhh]h)}(hUshow max tcp buf memory usage recorded This knob is deprecated and shouldn't be used.h]hWshow max tcp buf memory usage recorded This knob is deprecated and shouldn’t be used.}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhj: ubah}(h]h ]h"]h$]h&]uh1jThj ubeh}(h]h ]h"]h$]h&]uh1jOhjLubeh}(h]h ]h"]h$]h&]uh1jJhj1ubeh}(h]h ]h"]h$]h&]colsKuh1j/hj,ubah}(h]h ]h"]h$]h&]uh1j*hjhhhhhNubeh}(h]-benefits-and-purpose-of-the-memory-controllerah ]h"]-benefits and purpose of the memory controllerah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h 1. Historyh]h 1. History}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjr hhhhhKubh)}(hXThe memory controller has a long history. A request for comments for the memory controller was posted by Balbir Singh [1]_. At the time the RFC was posted there were several implementations for memory control. The goal of the RFC was to build consensus and agreement for the minimal features required for memory control. The first RSS controller was posted by Balbir Singh [2]_ in Feb 2007. Pavel Emelianov [3]_ [4]_ [5]_ has since posted three versions of the RSS controller. At OLS, at the resource management BoF, everyone suggested that we handle both page cache and RSS together. Another request was raised to allow user space handling of OOM. The current memory controller is at version 6; it combines both mapped (RSS) and unmapped Page Cache Control [11]_.h](hvThe memory controller has a long history. A request for comments for the memory controller was posted by Balbir Singh }(hj hhhNhNubj!)}(h[1]_h]h1}(hj hhhNhNubah}(h]id2ah ]h"]h$]h&]j1id8j3j4uh1j hj j5Kubh. At the time the RFC was posted there were several implementations for memory control. The goal of the RFC was to build consensus and agreement for the minimal features required for memory control. The first RSS controller was posted by Balbir Singh }(hj hhhNhNubj!)}(h[2]_h]h2}(hj hhhNhNubah}(h]id3ah ]h"]h$]h&]j1id9j3j4uh1j hj j5Kubh in Feb 2007. Pavel Emelianov }(hj hhhNhNubj!)}(h[3]_h]h3}(hj hhhNhNubah}(h]id4ah ]h"]h$]h&]j1id10j3j4uh1j hj j5Kubh }(hj hhhNhNubj!)}(h[4]_h]h4}(hj hhhNhNubah}(h]id5ah ]h"]h$]h&]j1id11j3j4uh1j hj j5Kubh }hj sbj!)}(h[5]_h]h5}(hj hhhNhNubah}(h]id6ah ]h"]h$]h&]j1id12j3j4uh1j hj j5KubhXQ has since posted three versions of the RSS controller. At OLS, at the resource management BoF, everyone suggested that we handle both page cache and RSS together. Another request was raised to allow user space handling of OOM. The current memory controller is at version 6; it combines both mapped (RSS) and unmapped Page Cache Control }(hj hhhNhNubj!)}(h[11]_h]h11}(hj hhhNhNubah}(h]id7ah ]h"]h$]h&]j1id13j3j4uh1j hj j5Kubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjr hhubeh}(h]historyah ]h"] 1. historyah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h2. Memory Controlh]h2. Memory Control}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hX#Memory is a unique resource in the sense that it is present in a limited amount. If a task requires a lot of CPU processing, the task can spread its processing over a period of hours, days, months or years, but with memory, the same physical memory needs to be reused to accomplish the task.h]hX#Memory is a unique resource in the sense that it is present in a limited amount. If a task requires a lot of CPU processing, the task can spread its processing over a period of hours, days, months or years, but with memory, the same physical memory needs to be reused to accomplish the task.}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hMThe memory controller implementation has been divided into phases. These are:h]hMThe memory controller implementation has been divided into phases. These are:}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjA)}(hhh](jF)}(hMemory controllerh]h)}(hjC h]hMemory controller}(hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjA ubah}(h]h ]h"]h$]h&]uh1jEhj> hhhhhNubjF)}(hmlock(2) controllerh]h)}(hjZ h]hmlock(2) controller}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjX ubah}(h]h ]h"]h$]h&]uh1jEhj> hhhhhNubjF)}(h.Kernel user memory accounting and slab controlh]h)}(hjq h]h.Kernel user memory accounting and slab control}(hjs hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjo ubah}(h]h ]h"]h$]h&]uh1jEhj> hhhhhNubjF)}(h user mappings length controller h]h)}(huser mappings length controllerh]huser mappings length controller}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jEhj> hhhhhNubeh}(h]h ]h"]h$]h&]jarabicjhjjuh1j@hj hhhhhKubh)}(h8The memory controller is the first controller developed.h]h8The memory controller is the first controller developed.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hhh](h)}(h 2.1. Designh]h 2.1. Design}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXThe core of the design is a counter called the page_counter. The page_counter tracks the current memory usage and limit of the group of processes associated with the controller. Each cgroup has a memory controller specific data structure (mem_cgroup) associated with it.h]hXThe core of the design is a counter called the page_counter. The page_counter tracks the current memory usage and limit of the group of processes associated with the controller. Each cgroup has a memory controller specific data structure (mem_cgroup) associated with it.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]designah ]h"] 2.1. designah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(h2.2. Accountingh]h2.2. Accounting}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh container)}(hhh](hcaption)}(h!Figure 1: Hierarchy of Accountingh]h!Figure 1: Hierarchy of Accounting}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hhhKhj ubh literal_block)}(hX +--------------------+ | mem_cgroup | | (page_counter) | +--------------------+ / ^ \ / | \ +---------------+ | +---------------+ | mm_struct | |.... | mm_struct | | | | | | +---------------+ | +---------------+ | + --------------+ | +---------------+ +------+--------+ | page +----------> page_cgroup| | | | | +---------------+ +---------------+h]hX +--------------------+ | mem_cgroup | | (page_counter) | +--------------------+ / ^ \ / | \ +---------------+ | +---------------+ | mm_struct | |.... | mm_struct | | | | | | +---------------+ | +---------------+ | + --------------+ | +---------------+ +------+--------+ | page +----------> page_cgroup| | | | | +---------------+ +---------------+}hj sbah}(h]h ]h"]h$]h&] xml:spacepreserveforcelanguagenonehighlight_args}uh1j hhhKhj ubeh}(h]id15ah ]literal-block-wrapperah"]h$]h&] literal_blockuh1j hj hhhhhNubh)}(h6Figure 1 shows the important aspects of the controllerh]h6Figure 1 shows the important aspects of the controller}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubjA)}(hhh](jF)}(hAccounting happens per cgrouph]h)}(hj3 h]hAccounting happens per cgroup}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1 ubah}(h]h ]h"]h$]h&]uh1jEhj. hhhhhNubjF)}(h5Each mm_struct knows about which cgroup it belongs toh]h)}(hjJ h]h5Each mm_struct knows about which cgroup it belongs to}(hjL hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjH ubah}(h]h ]h"]h$]h&]uh1jEhj. hhhhhNubjF)}(hYEach page has a pointer to the page_cgroup, which in turn knows the cgroup it belongs to h]h)}(hXEach page has a pointer to the page_cgroup, which in turn knows the cgroup it belongs toh]hXEach page has a pointer to the page_cgroup, which in turn knows the cgroup it belongs to}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj_ ubah}(h]h ]h"]h$]h&]uh1jEhj. hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1j@hj hhhhhKubh)}(hXThe accounting is done as follows: mem_cgroup_charge_common() is invoked to set up the necessary data structures and check if the cgroup that is being charged is over its limit. If it is, then reclaim is invoked on the cgroup. More details can be found in the reclaim section of this document. If everything goes well, a page meta-data-structure called page_cgroup is updated. page_cgroup has its own LRU on cgroup. (*) page_cgroup structure is allocated at boot/memory-hotplug time.h]hXThe accounting is done as follows: mem_cgroup_charge_common() is invoked to set up the necessary data structures and check if the cgroup that is being charged is over its limit. If it is, then reclaim is invoked on the cgroup. More details can be found in the reclaim section of this document. If everything goes well, a page meta-data-structure called page_cgroup is updated. page_cgroup has its own LRU on cgroup. (*) page_cgroup structure is allocated at boot/memory-hotplug time.}(hj} hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h] accountingah ]h"]2.2. accountingah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(h2.2.1 Accounting detailsh]h2.2.1 Accounting details}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hAll mapped anon pages (RSS) and cache pages (Page Cache) are accounted. Some pages which are never reclaimable and will not be on the LRU are not accounted. We just account pages under usual VM management.h]hAll mapped anon pages (RSS) and cache pages (Page Cache) are accounted. Some pages which are never reclaimable and will not be on the LRU are not accounted. We just account pages under usual VM management.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXRSS pages are accounted at page_fault unless they've already been accounted for earlier. A file page will be accounted for as Page Cache when it's inserted into inode (xarray). While it's mapped into the page tables of processes, duplicate accounting is carefully avoided.h]hXRSS pages are accounted at page_fault unless they’ve already been accounted for earlier. A file page will be accounted for as Page Cache when it’s inserted into inode (xarray). While it’s mapped into the page tables of processes, duplicate accounting is carefully avoided.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXLAn RSS page is unaccounted when it's fully unmapped. A PageCache page is unaccounted when it's removed from xarray. Even if RSS pages are fully unmapped (by kswapd), they may exist as SwapCache in the system until they are really freed. Such SwapCaches are also accounted. A swapped-in page is accounted after adding into swapcache.h]hXPAn RSS page is unaccounted when it’s fully unmapped. A PageCache page is unaccounted when it’s removed from xarray. Even if RSS pages are fully unmapped (by kswapd), they may exist as SwapCache in the system until they are really freed. Such SwapCaches are also accounted. A swapped-in page is accounted after adding into swapcache.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hNote: The kernel does swapin-readahead and reads multiple swaps at once. Since page's memcg recorded into swap whatever memsw enabled, the page will be accounted after swapin.h]hNote: The kernel does swapin-readahead and reads multiple swaps at once. Since page’s memcg recorded into swap whatever memsw enabled, the page will be accounted after swapin.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(h2At page migration, accounting information is kept.h]h2At page migration, accounting information is kept.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hNote: we just account pages-on-LRU because our purpose is to control amount of used pages; not-on-LRU pages tend to be out-of-control from VM view.h]hNote: we just account pages-on-LRU because our purpose is to control amount of used pages; not-on-LRU pages tend to be out-of-control from VM view.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]accounting-detailsah ]h"]2.2.1 accounting detailsah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(h2.3 Shared Page Accountingh]h2.3 Shared Page Accounting}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hXbShared pages are accounted on the basis of the first touch approach. The cgroup that first touches a page is accounted for the page. The principle behind this approach is that a cgroup that aggressively uses a shared page will eventually get charged for it (once it is uncharged from the cgroup that brought it in -- this will happen on memory pressure).h]hXbShared pages are accounted on the basis of the first touch approach. The cgroup that first touches a page is accounted for the page. The principle behind this approach is that a cgroup that aggressively uses a shared page will eventually get charged for it (once it is uncharged from the cgroup that brought it in -- this will happen on memory pressure).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]shared-page-accountingah ]h"]2.3 shared page accountingah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(h2.4 Swap Extensionh]h2.4 Swap Extension}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj' hhhhhKubh)}(haSwap usage is always recorded for each of cgroup. Swap Extension allows you to read and limit it.h]haSwap usage is always recorded for each of cgroup. Swap Extension allows you to read and limit it.}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj' hhubh)}(h7When CONFIG_SWAP is enabled, following files are added.h]h7When CONFIG_SWAP is enabled, following files are added.}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj' hhubj)}(h>- memory.memsw.usage_in_bytes. - memory.memsw.limit_in_bytes. h]j)}(hhh](jF)}(hmemory.memsw.usage_in_bytes.h]h)}(hj] h]hmemory.memsw.usage_in_bytes.}(hj_ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj[ ubah}(h]h ]h"]h$]h&]uh1jEhjX ubjF)}(hmemory.memsw.limit_in_bytes. h]h)}(hmemory.memsw.limit_in_bytes.h]hmemory.memsw.limit_in_bytes.}(hjv hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjr ubah}(h]h ]h"]h$]h&]uh1jEhjX ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhjT ubah}(h]h ]h"]h$]h&]uh1jhhhKhj' hhubh)}(hQmemsw means memory+swap. Usage of memory+swap is limited by memsw.limit_in_bytes.h]hQmemsw means memory+swap. Usage of memory+swap is limited by memsw.limit_in_bytes.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj' hhubh)}(hX-Example: Assume a system with 4G of swap. A task which allocates 6G of memory (by mistake) under 2G memory limitation will use all swap. In this case, setting memsw.limit_in_bytes=3G will prevent bad use of swap. By using the memsw limit, you can avoid system OOM which can be caused by swap shortage.h]hX-Example: Assume a system with 4G of swap. A task which allocates 6G of memory (by mistake) under 2G memory limitation will use all swap. In this case, setting memsw.limit_in_bytes=3G will prevent bad use of swap. By using the memsw limit, you can avoid system OOM which can be caused by swap shortage.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj' hhubh)}(hhh](h)}(h(2.4.1 why 'memory+swap' rather than swaph]h,2.4.1 why ‘memory+swap’ rather than swap}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM ubh)}(hX9The global LRU(kswapd) can swap out arbitrary pages. Swap-out means to move account from memory to swap...there is no change in usage of memory+swap. In other words, when we want to limit the usage of swap without affecting global LRU, memory+swap limit is better than just limiting swap from an OS point of view.h]hX9The global LRU(kswapd) can swap out arbitrary pages. Swap-out means to move account from memory to swap...there is no change in usage of memory+swap. In other words, when we want to limit the usage of swap without affecting global LRU, memory+swap limit is better than just limiting swap from an OS point of view.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj hhubeh}(h] why-memory-swap-rather-than-swapah ]h"](2.4.1 why 'memory+swap' rather than swapah$]h&]uh1hhj' hhhhhM ubh)}(hhh](h)}(hB2.4.2. What happens when a cgroup hits memory.memsw.limit_in_bytesh]hB2.4.2. What happens when a cgroup hits memory.memsw.limit_in_bytes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hX>When a cgroup hits memory.memsw.limit_in_bytes, it's useless to do swap-out in this cgroup. Then, swap-out will not be done by cgroup routine and file caches are dropped. But as mentioned above, global LRU can do swapout memory from it for sanity of the system's memory management state. You can't forbid it by cgroup.h]hXDWhen a cgroup hits memory.memsw.limit_in_bytes, it’s useless to do swap-out in this cgroup. Then, swap-out will not be done by cgroup routine and file caches are dropped. But as mentioned above, global LRU can do swapout memory from it for sanity of the system’s memory management state. You can’t forbid it by cgroup.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h];what-happens-when-a-cgroup-hits-memory-memsw-limit-in-bytesah ]h"]B2.4.2. what happens when a cgroup hits memory.memsw.limit_in_bytesah$]h&]uh1hhj' hhhhhMubeh}(h]swap-extensionah ]h"]2.4 swap extensionah$]h&]uh1hhj hhhhhKubh)}(hhh](h)}(h 2.5 Reclaimh]h 2.5 Reclaim}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hXEach cgroup maintains a per cgroup LRU which has the same structure as global VM. When a cgroup goes over its limit, we first try to reclaim memory from the cgroup so as to make space for the new pages that the cgroup has touched. If the reclaim is unsuccessful, an OOM routine is invoked to select and kill the bulkiest task in the cgroup. (See :ref:`10. OOM Control ` below.)h](hXZEach cgroup maintains a per cgroup LRU which has the same structure as global VM. When a cgroup goes over its limit, we first try to reclaim memory from the cgroup so as to make space for the new pages that the cgroup has touched. If the reclaim is unsuccessful, an OOM routine is invoked to select and kill the bulkiest task in the cgroup. (See }(hj hhhNhNubh)}(h5:ref:`10. OOM Control `h]j)}(hj# h]h10. OOM Control}(hj% hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj! ubah}(h]h ]h"]h$]h&]refdocj4 refdomainj/ reftyperef refexplicitrefwarnj cgroup-v1-memory-oom-controluh1hhhhMhj ubh below.)}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hThe reclaim algorithm has not been modified for cgroups, except that pages that are selected for reclaiming come from the per-cgroup LRU list.h]hThe reclaim algorithm has not been modified for cgroups, except that pages that are selected for reclaiming come from the per-cgroup LRU list.}(hjK hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hj hhubh)}(h]Reclaim does not work for the root cgroup, since we cannot set any limits on the root cgroup.h]h)}(h]Reclaim does not work for the root cgroup, since we cannot set any limits on the root cgroup.h]h]Reclaim does not work for the root cgroup, since we cannot set any limits on the root cgroup.}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM*hjY ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h=When panic_on_oom is set to "2", the whole system will panic.h]h)}(hjs h]hAWhen panic_on_oom is set to “2”, the whole system will panic.}(hju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjq ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(hWhen oom event notifier is registered, event will be delivered. (See :ref:`oom_control ` section)h](hEWhen oom event notifier is registered, event will be delivered. (See }(hj hhhNhNubh)}(h1:ref:`oom_control `h]j)}(hj h]h oom_control}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj4 refdomainj reftyperef refexplicitrefwarnj cgroup-v1-memory-oom-controluh1hhhhM0hj ubh section)}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM0hj hhubeh}(h]reclaimah ]h"] 2.5 reclaimah$]h&]uh1hhj hhhhhMubh)}(hhh](h)}(h 2.6 Lockingh]h 2.6 Locking}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM4ubh)}(hLock order is as follows::h]hLock order is as follows:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hj hhubj )}(hfolio_lock mm->page_table_lock or split pte_lock folio_memcg_lock (memcg->move_lock) mapping->i_pages lock lruvec->lru_lock.h]hfolio_lock mm->page_table_lock or split pte_lock folio_memcg_lock (memcg->move_lock) mapping->i_pages lock lruvec->lru_lock.}hj sbah}(h]h ]h"]h$]h&]j j uh1j hhhM8hj hhubh)}(hPer-node-per-memcgroup LRU (cgroup's private LRU) is guarded by lruvec->lru_lock; the folio LRU flag is cleared before isolating a page from its LRU under lruvec->lru_lock.h]hPer-node-per-memcgroup LRU (cgroup’s private LRU) is guarded by lruvec->lru_lock; the folio LRU flag is cleared before isolating a page from its LRU under lruvec->lru_lock.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hj hhubhtarget)}(h&.. _cgroup-v1-memory-kernel-extension:h]h}(h]h ]h"]h$]h&]j1!cgroup-v1-memory-kernel-extensionuh1j hMBhj hhhhubeh}(h]lockingah ]h"] 2.6 lockingah$]h&]uh1hhj hhhhhM4ubh)}(hhh](h)}(h2.7 Kernel Memory Extensionh]h2.7 Kernel Memory Extension}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMEubh)}(hX-With the Kernel memory extension, the Memory Controller is able to limit the amount of kernel memory used by the system. Kernel memory is fundamentally different than user memory, since it can't be swapped out, which makes it possible to DoS the system by consuming too much of this precious resource.h]hX/With the Kernel memory extension, the Memory Controller is able to limit the amount of kernel memory used by the system. Kernel memory is fundamentally different than user memory, since it can’t be swapped out, which makes it possible to DoS the system by consuming too much of this precious resource.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjhhubh)}(hKernel memory accounting is enabled for all memory cgroups by default. But it can be disabled system-wide by passing cgroup.memory=nokmem to the kernel at boot time. In this case, kernel memory will not be accounted at all.h]hKernel memory accounting is enabled for all memory cgroups by default. But it can be disabled system-wide by passing cgroup.memory=nokmem to the kernel at boot time. In this case, kernel memory will not be accounted at all.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMLhjhhubh)}(hKernel memory limits are not imposed for the root cgroup. Usage for the root cgroup may or may not be accounted. The memory used is accumulated into memory.kmem.usage_in_bytes, or in a separate counter when it makes sense. (currently only for tcp).h]hKernel memory limits are not imposed for the root cgroup. Usage for the root cgroup may or may not be accounted. The memory used is accumulated into memory.kmem.usage_in_bytes, or in a separate counter when it makes sense. (currently only for tcp).}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjhhubh)}(hqThe main "kmem" counter is fed into the main counter, so kmem charges will also be visible from the user counter.h]huThe main “kmem” counter is fed into the main counter, so kmem charges will also be visible from the user counter.}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhjhhubh)}(hCurrently no soft limit is implemented for kernel memory. It is future work to trigger slab reclaim when those limits are reached.h]hCurrently no soft limit is implemented for kernel memory. It is future work to trigger slab reclaim when those limits are reached.}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMXhjhhubeh}(h](kernel-memory-extensionj eh ]h"](2.7 kernel memory extension!cgroup-v1-memory-kernel-extensioneh$]h&]uh1hhj hhhhhMEexpect_referenced_by_name}joj sexpect_referenced_by_id}j j subh)}(hhh](h)}(h/2.7.1 Current Kernel Memory resources accountedh]h/2.7.1 Current Kernel Memory resources accounted}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjvhhhhhM\ubhdefinition_list)}(hhh](hdefinition_list_item)}(hstack pages: every process consumes some stack pages. By accounting into kernel memory, we prevent new processes from being created when the kernel memory usage is too high. h](hterm)}(h stack pages:h]h stack pages:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMahjubh definition)}(hhh]h)}(hevery process consumes some stack pages. By accounting into kernel memory, we prevent new processes from being created when the kernel memory usage is too high.h]hevery process consumes some stack pages. By accounting into kernel memory, we prevent new processes from being created when the kernel memory usage is too high.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMahjubj)}(hXslab pages: pages allocated by the SLAB or SLUB allocator are tracked. A copy of each kmem_cache is created every time the cache is touched by the first time from inside the memcg. The creation is done lazily, so some objects can still be skipped while the cache is being created. All objects in a slab page should belong to the same memcg. This only fails to hold when a task is migrated to a different memcg during the page allocation by the cache. h](j)}(h slab pages:h]h slab pages:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMihjubj)}(hhh]h)}(hXpages allocated by the SLAB or SLUB allocator are tracked. A copy of each kmem_cache is created every time the cache is touched by the first time from inside the memcg. The creation is done lazily, so some objects can still be skipped while the cache is being created. All objects in a slab page should belong to the same memcg. This only fails to hold when a task is migrated to a different memcg during the page allocation by the cache.h]hXpages allocated by the SLAB or SLUB allocator are tracked. A copy of each kmem_cache is created every time the cache is touched by the first time from inside the memcg. The creation is done lazily, so some objects can still be skipped while the cache is being created. All objects in a slab page should belong to the same memcg. This only fails to hold when a task is migrated to a different memcg during the page allocation by the cache.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMihjhhubj)}(hsockets memory pressure: some sockets protocols have memory pressure thresholds. The Memory Controller allows them to be controlled individually per cgroup, instead of globally. h](j)}(hsockets memory pressure:h]hsockets memory pressure:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMnhjubj)}(hhh]h)}(hsome sockets protocols have memory pressure thresholds. The Memory Controller allows them to be controlled individually per cgroup, instead of globally.h]hsome sockets protocols have memory pressure thresholds. The Memory Controller allows them to be controlled individually per cgroup, instead of globally.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMlhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMnhjhhubj)}(hCtcp memory pressure: sockets memory pressure for the tcp protocol. h](j)}(htcp memory pressure:h]htcp memory pressure:}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMqhjubj)}(hhh]h)}(h-sockets memory pressure for the tcp protocol.h]h-sockets memory pressure for the tcp protocol.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMqhj1ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMqhjhhubeh}(h]h ]h"]h$]h&]uh1jhjvhhhhhNubeh}(h])current-kernel-memory-resources-accountedah ]h"]/2.7.1 current kernel memory resources accountedah$]h&]uh1hhj hhhhhM\ubh)}(hhh](h)}(h2.7.2 Common use casesh]h2.7.2 Common use cases}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\hhhhhMtubh)}(hBecause the "kmem" counter is fed to the main user counter, kernel memory can never be limited completely independently of user memory. Say "U" is the user limit, and "K" the kernel limit. There are three possible ways limits can be set:h]hBecause the “kmem” counter is fed to the main user counter, kernel memory can never be limited completely independently of user memory. Say “U” is the user limit, and “K” the kernel limit. There are three possible ways limits can be set:}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMvhj\hhubj)}(hhh](j)}(hU != 0, K = unlimited: This is the standard memcg limitation mechanism already present before kmem accounting. Kernel memory is completely ignored. h](j)}(hU != 0, K = unlimited:h]hU != 0, K = unlimited:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM}hj~ubj)}(hhh]h)}(h|This is the standard memcg limitation mechanism already present before kmem accounting. Kernel memory is completely ignored.h]h|This is the standard memcg limitation mechanism already present before kmem accounting. Kernel memory is completely ignored.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM|hjubah}(h]h ]h"]h$]h&]uh1jhj~ubeh}(h]h ]h"]h$]h&]uh1jhhhM}hj{ubj)}(hXeU != 0, K < U: Kernel memory is a subset of the user memory. This setup is useful in deployments where the total amount of memory per-cgroup is overcommitted. Overcommitting kernel memory limits is definitely not recommended, since the box can still run out of non-reclaimable memory. In this case, the admin could set up K so that the sum of all groups is never greater than the total memory, and freely set U at the cost of his QoS. .. warning:: In the current implementation, memory reclaim will NOT be triggered for a cgroup when it hits K while staying below U, which makes this setup impractical. h](j)}(hU != 0, K < U:h]hU != 0, K < U:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhjubj)}(hhh](h)}(hXKernel memory is a subset of the user memory. This setup is useful in deployments where the total amount of memory per-cgroup is overcommitted. Overcommitting kernel memory limits is definitely not recommended, since the box can still run out of non-reclaimable memory. In this case, the admin could set up K so that the sum of all groups is never greater than the total memory, and freely set U at the cost of his QoS.h]hXKernel memory is a subset of the user memory. This setup is useful in deployments where the total amount of memory per-cgroup is overcommitted. Overcommitting kernel memory limits is definitely not recommended, since the box can still run out of non-reclaimable memory. In this case, the admin could set up K so that the sum of all groups is never greater than the total memory, and freely set U at the cost of his QoS.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubhwarning)}(hIn the current implementation, memory reclaim will NOT be triggered for a cgroup when it hits K while staying below U, which makes this setup impractical.h]h)}(hIn the current implementation, memory reclaim will NOT be triggered for a cgroup when it hits K while staying below U, which makes this setup impractical.h]hIn the current implementation, memory reclaim will NOT be triggered for a cgroup when it hits K while staying below U, which makes this setup impractical.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhj{hhubj)}(hXU != 0, K >= U: Since kmem charges will also be fed to the user counter and reclaim will be triggered for the cgroup for both kinds of memory. This setup gives the admin a unified view of memory, and it is also useful for people who just want to track kernel memory usage. h](j)}(hU != 0, K >= U:h]hU != 0, K >= U:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMhjubj)}(hhh]h)}(hXSince kmem charges will also be fed to the user counter and reclaim will be triggered for the cgroup for both kinds of memory. This setup gives the admin a unified view of memory, and it is also useful for people who just want to track kernel memory usage.h]hXSince kmem charges will also be fed to the user counter and reclaim will be triggered for the cgroup for both kinds of memory. This setup gives the admin a unified view of memory, and it is also useful for people who just want to track kernel memory usage.}(hj  hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhj{hhubeh}(h]h ]h"]h$]h&]uh1jhj\hhhhhNubeh}(h]common-use-casesah ]h"]2.7.2 common use casesah$]h&]uh1hhj hhhhhMtubeh}(h]memory-controlah ]h"]2. memory controlah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h3. User Interfaceh]h3. User Interface}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhMubh)}(hTo use the user interface:h]hTo use the user interface:}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubjA)}(hhh](jF)}(h.Enable CONFIG_CGROUPS and CONFIG_MEMCG optionsh]h)}(hj_h]h.Enable CONFIG_CGROUPS and CONFIG_MEMCG options}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj]ubah}(h]h ]h"]h$]h&]uh1jEhjZhhhhhNubjF)}(hPrepare the cgroups (see :ref:`Why are cgroups needed? ` for the background information):: # mount -t tmpfs none /sys/fs/cgroup # mkdir /sys/fs/cgroup/memory # mount -t cgroup none /sys/fs/cgroup/memory -o memory h](h)}(hnPrepare the cgroups (see :ref:`Why are cgroups needed? ` for the background information)::h](hPrepare the cgroups (see }(hjxhhhNhNubh)}(h3:ref:`Why are cgroups needed? `h]j)}(hjh]hWhy are cgroups needed?}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj4 refdomainjreftyperef refexplicitrefwarnj cgroups-why-neededuh1hhhhMhjxubh! for the background information):}(hjxhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjtubj )}(hy# mount -t tmpfs none /sys/fs/cgroup # mkdir /sys/fs/cgroup/memory # mount -t cgroup none /sys/fs/cgroup/memory -o memoryh]hy# mount -t tmpfs none /sys/fs/cgroup # mkdir /sys/fs/cgroup/memory # mount -t cgroup none /sys/fs/cgroup/memory -o memory}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjtubeh}(h]h ]h"]h$]h&]uh1jEhjZhhhhhNubjF)}(hMake the new group and move bash into it:: # mkdir /sys/fs/cgroup/memory/0 # echo $$ > /sys/fs/cgroup/memory/0/tasks h](h)}(h*Make the new group and move bash into it::h]h)Make the new group and move bash into it:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj )}(hI# mkdir /sys/fs/cgroup/memory/0 # echo $$ > /sys/fs/cgroup/memory/0/tasksh]hI# mkdir /sys/fs/cgroup/memory/0 # echo $$ > /sys/fs/cgroup/memory/0/tasks}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjubeh}(h]h ]h"]h$]h&]uh1jEhjZhhhhhNubjF)}(hSince now we're in the 0 cgroup, we can alter the memory limit:: # echo 4M > /sys/fs/cgroup/memory/0/memory.limit_in_bytes The limit can now be queried:: # cat /sys/fs/cgroup/memory/0/memory.limit_in_bytes 4194304 h](h)}(h@Since now we're in the 0 cgroup, we can alter the memory limit::h]hASince now we’re in the 0 cgroup, we can alter the memory limit:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj )}(h9# echo 4M > /sys/fs/cgroup/memory/0/memory.limit_in_bytesh]h9# echo 4M > /sys/fs/cgroup/memory/0/memory.limit_in_bytes}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjubh)}(hThe limit can now be queried::h]hThe limit can now be queried:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj )}(h;# cat /sys/fs/cgroup/memory/0/memory.limit_in_bytes 4194304h]h;# cat /sys/fs/cgroup/memory/0/memory.limit_in_bytes 4194304}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjubeh}(h]h ]h"]h$]h&]uh1jEhjZhhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1j@hj;hhhhhMubh)}(hWe can use a suffix (k, K, m, M, g or G) to indicate values in kilo, mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, Gibibytes.)h]h)}(hWe can use a suffix (k, K, m, M, g or G) to indicate values in kilo, mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, Gibibytes.)h]hWe can use a suffix (k, K, m, M, g or G) to indicate values in kilo, mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, Gibibytes.)}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,ubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhNubh)}(h?We can write "-1" to reset the ``*.limit_in_bytes(unlimited)``.h]h)}(hjFh](h#We can write “-1” to reset the }(hjHhhhNhNubhliteral)}(h``*.limit_in_bytes(unlimited)``h]h*.limit_in_bytes(unlimited)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jOhjHubh.}(hjHhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjDubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhNubh)}(h1We cannot set limits on the root cgroup any more.h]h)}(hjqh]h1We cannot set limits on the root cgroup any more.}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjoubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhNubh)}(hWe can check the usage::h]hWe can check the usage:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubj )}(h;# cat /sys/fs/cgroup/memory/0/memory.usage_in_bytes 1216512h]h;# cat /sys/fs/cgroup/memory/0/memory.usage_in_bytes 1216512}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhj;hhubh)}(hXdA successful write to this file does not guarantee a successful setting of this limit to the value written into the file. This can be due to a number of factors, such as rounding up to page boundaries or the total availability of memory on the system. The user is required to re-read this file after a write to guarantee the value committed by the kernel::h]hXcA successful write to this file does not guarantee a successful setting of this limit to the value written into the file. This can be due to a number of factors, such as rounding up to page boundaries or the total availability of memory on the system. The user is required to re-read this file after a write to guarantee the value committed by the kernel:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubj )}(hA# echo 1 > memory.limit_in_bytes # cat memory.limit_in_bytes 4096h]hA# echo 1 > memory.limit_in_bytes # cat memory.limit_in_bytes 4096}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhj;hhubh)}(hVThe memory.failcnt field gives the number of times that the cgroup limit was exceeded.h]hVThe memory.failcnt field gives the number of times that the cgroup limit was exceeded.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubh)}(h|The memory.stat file gives accounting information. Now, the number of caches, RSS and Active pages/Inactive pages are shown.h]h|The memory.stat file gives accounting information. Now, the number of caches, RSS and Active pages/Inactive pages are shown.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubeh}(h]user-interfaceah ]h"]3. user interfaceah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h 4. Testingh]h 4. Testing}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(h /proc/sys/vm/drop_caches will help get rid of some of the pages cached in the cgroup (page cache pages).h]hA sync followed by echo 1 > /proc/sys/vm/drop_caches will help get rid of some of the pages cached in the cgroup (page cache pages).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj6hhubh)}(hTo know what happens, disabling OOM_Kill as per :ref:`"10. OOM Control" ` (below) and seeing what happens will be helpful.h](h0To know what happens, disabling OOM_Kill as per }(hjhhhNhNubh)}(h7:ref:`"10. OOM Control" `h]j)}(hjh]h“10. OOM Control”}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj4 refdomainjreftyperef refexplicitrefwarnj cgroup-v1-memory-oom-controluh1hhhhMhjubh1 (below) and seeing what happens will be helpful.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj6hhubj )}(h).. _cgroup-v1-memory-test-task-migration:h]h}(h]h ]h"]h$]h&]j1$cgroup-v1-memory-test-task-migrationuh1j hMhj6hhhhubeh}(h](troubleshootingj5eh ]h"](4.1 troubleshooting"cgroup-v1-memory-test-troubleshooteh$]h&]uh1hhjhhhhhMjr}jj+sjt}j5j+subh)}(hhh](h)}(h4.2 Task migrationh]h4.2 Task migration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hWhen a task migrates from one cgroup to another, its charge is not carried forward by default. The pages allocated from the original cgroup still remain charged to it, the charge is dropped when the page is freed or reclaimed.h]hWhen a task migrates from one cgroup to another, its charge is not carried forward by default. The pages allocated from the original cgroup still remain charged to it, the charge is dropped when the page is freed or reclaimed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hYou can move charges of a task along with task migration. See :ref:`8. "Move charges at task migration" `h](h>You can move charges of a task along with task migration. See }(hjhhhNhNubh)}(hJ:ref:`8. "Move charges at task migration" `h]j)}(hj h]h'8. “Move charges at task migration”}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj4 refdomainjreftyperef refexplicitrefwarnj cgroup-v1-memory-move-chargesuh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h](task-migrationjeh ]h"](4.2 task migration$cgroup-v1-memory-test-task-migrationeh$]h&]uh1hhjhhhhhMjr}j6jsjt}jjsubh)}(hhh](h)}(h4.3 Removing a cgrouph]h4.3 Removing a cgroup}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj;hhhhhMubh)}(hXAA cgroup can be removed by rmdir, but as discussed in :ref:`sections 4.1 ` and :ref:`4.2 `, a cgroup might have some charge associated with it, even though all tasks have migrated away from it. (because we charge against pages, not against tasks.)h](h6A cgroup can be removed by rmdir, but as discussed in }(hjLhhhNhNubh)}(h8:ref:`sections 4.1 `h]j)}(hjVh]h sections 4.1}(hjXhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjTubah}(h]h ]h"]h$]h&]refdocj4 refdomainjbreftyperef refexplicitrefwarnj "cgroup-v1-memory-test-troubleshootuh1hhhhMhjLubh and }(hjLhhhNhNubh)}(h1:ref:`4.2 `h]j)}(hjzh]h4.2}(hj|hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjxubah}(h]h ]h"]h$]h&]refdocj4 refdomainjreftyperef refexplicitrefwarnj $cgroup-v1-memory-test-task-migrationuh1hhhhMhjLubh, a cgroup might have some charge associated with it, even though all tasks have migrated away from it. (because we charge against pages, not against tasks.)}(hjLhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubh)}(hZWe move the stats to parent, and no change on the charge except uncharging from the child.h]hZWe move the stats to parent, and no change on the charge except uncharging from the child.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj;hhubh)}(hCharges recorded in swap information is not updated at removal of cgroup. Recorded information is discarded and a cgroup which uses swap (swapcache) will be charged as a new owner of it.h]hCharges recorded in swap information is not updated at removal of cgroup. Recorded information is discarded and a cgroup which uses swap (swapcache) will be charged as a new owner of it.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj;hhubeh}(h]removing-a-cgroupah ]h"]4.3 removing a cgroupah$]h&]uh1hhjhhhhhMubeh}(h]testingah ]h"] 4. testingah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h5. Misc. interfacesh]h5. Misc. interfaces}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h5.1 force_emptyh]h5.1 force_empty}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj)}(hXmemory.force_empty interface is provided to make cgroup's memory usage empty. When writing anything to this:: # echo 0 > memory.force_empty the cgroup will be reclaimed and as many pages reclaimed as possible. The typical use case for this interface is before calling rmdir(). Though rmdir() offlines memcg, but the memcg may still stay there due to charged file caches. Some out-of-use page caches may keep charged until memory pressure happens. If you want to avoid that, force_empty will be useful. h](h)}(hmmemory.force_empty interface is provided to make cgroup's memory usage empty. When writing anything to this::h]hnmemory.force_empty interface is provided to make cgroup’s memory usage empty. When writing anything to this:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj )}(h# echo 0 > memory.force_emptyh]h# echo 0 > memory.force_empty}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjubh)}(hEthe cgroup will be reclaimed and as many pages reclaimed as possible.h]hEthe cgroup will be reclaimed and as many pages reclaimed as possible.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hX#The typical use case for this interface is before calling rmdir(). Though rmdir() offlines memcg, but the memcg may still stay there due to charged file caches. Some out-of-use page caches may keep charged until memory pressure happens. If you want to avoid that, force_empty will be useful.h]hX#The typical use case for this interface is before calling rmdir(). Though rmdir() offlines memcg, but the memcg may still stay there due to charged file caches. Some out-of-use page caches may keep charged until memory pressure happens. If you want to avoid that, force_empty will be useful.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubeh}(h] force-emptyah ]h"]5.1 force_emptyah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h 5.2 stat fileh]h 5.2 stat file}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hhhhhM ubh)}(h/memory.stat file includes following statistics:h]h/memory.stat file includes following statistics:}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hj:hhubj)}(hX * per-memory cgroup local status =============== =============================================================== cache # of bytes of page cache memory. rss # of bytes of anonymous and swap cache memory (includes transparent hugepages). rss_huge # of bytes of anonymous transparent hugepages. mapped_file # of bytes of mapped file (includes tmpfs/shmem) pgpgin # of charging events to the memory cgroup. The charging event happens each time a page is accounted as either mapped anon page(RSS) or cache page(Page Cache) to the cgroup. pgpgout # of uncharging events to the memory cgroup. The uncharging event happens each time a page is unaccounted from the cgroup. swap # of bytes of swap usage swapcached # of bytes of swap cached in memory dirty # of bytes that are waiting to get written back to the disk. writeback # of bytes of file/anon cache that are queued for syncing to disk. inactive_anon # of bytes of anonymous and swap cache memory on inactive LRU list. active_anon # of bytes of anonymous and swap cache memory on active LRU list. inactive_file # of bytes of file-backed memory and MADV_FREE anonymous memory (LazyFree pages) on inactive LRU list. active_file # of bytes of file-backed memory on active LRU list. unevictable # of bytes of memory that cannot be reclaimed (mlocked etc). =============== =============================================================== * status considering hierarchy (see memory.use_hierarchy settings): ========================= =================================================== hierarchical_memory_limit # of bytes of memory limit with regard to hierarchy under which the memory cgroup is hierarchical_memsw_limit # of bytes of memory+swap limit with regard to hierarchy under which memory cgroup is. total_ # hierarchical version of , which in addition to the cgroup's own value includes the sum of all hierarchical children's values of , i.e. total_cache ========================= =================================================== * additional vm parameters (depends on CONFIG_DEBUG_VM): ========================= ======================================== recent_rotated_anon VM internal parameter. (see mm/vmscan.c) recent_rotated_file VM internal parameter. (see mm/vmscan.c) recent_scanned_anon VM internal parameter. (see mm/vmscan.c) recent_scanned_file VM internal parameter. (see mm/vmscan.c) ========================= ======================================== h]j)}(hhh](jF)}(hXUper-memory cgroup local status =============== =============================================================== cache # of bytes of page cache memory. rss # of bytes of anonymous and swap cache memory (includes transparent hugepages). rss_huge # of bytes of anonymous transparent hugepages. mapped_file # of bytes of mapped file (includes tmpfs/shmem) pgpgin # of charging events to the memory cgroup. The charging event happens each time a page is accounted as either mapped anon page(RSS) or cache page(Page Cache) to the cgroup. pgpgout # of uncharging events to the memory cgroup. The uncharging event happens each time a page is unaccounted from the cgroup. swap # of bytes of swap usage swapcached # of bytes of swap cached in memory dirty # of bytes that are waiting to get written back to the disk. writeback # of bytes of file/anon cache that are queued for syncing to disk. inactive_anon # of bytes of anonymous and swap cache memory on inactive LRU list. active_anon # of bytes of anonymous and swap cache memory on active LRU list. inactive_file # of bytes of file-backed memory and MADV_FREE anonymous memory (LazyFree pages) on inactive LRU list. active_file # of bytes of file-backed memory on active LRU list. unevictable # of bytes of memory that cannot be reclaimed (mlocked etc). =============== =============================================================== h](h)}(hper-memory cgroup local statush]hper-memory cgroup local status}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hj`ubj+)}(hhh]j0)}(hhh](j5)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j4hjuubj5)}(hhh]h}(h]h ]h"]h$]h&]colwidthK?uh1j4hjuubjK)}(hhh](jP)}(hhh](jU)}(hhh]h)}(hcacheh]hcache}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h # of bytes of page cache memory.h]h # of bytes of page cache memory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hrssh]hrss}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hO# of bytes of anonymous and swap cache memory (includes transparent hugepages).h]hO# of bytes of anonymous and swap cache memory (includes transparent hugepages).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hrss_hugeh]hrss_huge}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM*hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h.# of bytes of anonymous transparent hugepages.h]h.# of bytes of anonymous transparent hugepages.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM*hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h mapped_fileh]h mapped_file}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hj7ubah}(h]h ]h"]h$]h&]uh1jThj4ubjU)}(hhh]h)}(h0# of bytes of mapped file (includes tmpfs/shmem)h]h0# of bytes of mapped file (includes tmpfs/shmem)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hjNubah}(h]h ]h"]h$]h&]uh1jThj4ubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hpgpginh]hpgpgin}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjnubah}(h]h ]h"]h$]h&]uh1jThjkubjU)}(hhh]h)}(h# of charging events to the memory cgroup. The charging event happens each time a page is accounted as either mapped anon page(RSS) or cache page(Page Cache) to the cgroup.h]h# of charging events to the memory cgroup. The charging event happens each time a page is accounted as either mapped anon page(RSS) or cache page(Page Cache) to the cgroup.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjubah}(h]h ]h"]h$]h&]uh1jThjkubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hpgpgouth]hpgpgout}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hz# of uncharging events to the memory cgroup. The uncharging event happens each time a page is unaccounted from the cgroup.h]hz# of uncharging events to the memory cgroup. The uncharging event happens each time a page is unaccounted from the cgroup.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hswaph]hswap}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h# of bytes of swap usageh]h# of bytes of swap usage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h swapcachedh]h swapcached}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h## of bytes of swap cached in memoryh]h## of bytes of swap cached in memory}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hj*ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hdirtyh]hdirty}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjJubah}(h]h ]h"]h$]h&]uh1jThjGubjU)}(hhh]h)}(h<# of bytes that are waiting to get written back to the disk.h]h<# of bytes that are waiting to get written back to the disk.}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjaubah}(h]h ]h"]h$]h&]uh1jThjGubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h writebackh]h writeback}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hjubah}(h]h ]h"]h$]h&]uh1jThj~ubjU)}(hhh]h)}(hB# of bytes of file/anon cache that are queued for syncing to disk.h]hB# of bytes of file/anon cache that are queued for syncing to disk.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hjubah}(h]h ]h"]h$]h&]uh1jThj~ubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h inactive_anonh]h inactive_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hC# of bytes of anonymous and swap cache memory on inactive LRU list.h]hC# of bytes of anonymous and swap cache memory on inactive LRU list.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h active_anonh]h active_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM9hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hA# of bytes of anonymous and swap cache memory on active LRU list.h]hA# of bytes of anonymous and swap cache memory on active LRU list.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM9hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h inactive_fileh]h inactive_file}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM;hj&ubah}(h]h ]h"]h$]h&]uh1jThj#ubjU)}(hhh]h)}(hf# of bytes of file-backed memory and MADV_FREE anonymous memory (LazyFree pages) on inactive LRU list.h]hf# of bytes of file-backed memory and MADV_FREE anonymous memory (LazyFree pages) on inactive LRU list.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM;hj=ubah}(h]h ]h"]h$]h&]uh1jThj#ubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h active_fileh]h active_file}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hj]ubah}(h]h ]h"]h$]h&]uh1jThjZubjU)}(hhh]h)}(h4# of bytes of file-backed memory on active LRU list.h]h4# of bytes of file-backed memory on active LRU list.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hjtubah}(h]h ]h"]h$]h&]uh1jThjZubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(h unevictableh]h unevictable}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h<# of bytes of memory that cannot be reclaimed (mlocked etc).h]h<# of bytes of memory that cannot be reclaimed (mlocked etc).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1jJhjuubeh}(h]h ]h"]h$]h&]colsKuh1j/hjrubah}(h]h ]h"]h$]h&]uh1j*hj`ubeh}(h]h ]h"]h$]h&]uh1jEhj]ubjF)}(hXstatus considering hierarchy (see memory.use_hierarchy settings): ========================= =================================================== hierarchical_memory_limit # of bytes of memory limit with regard to hierarchy under which the memory cgroup is hierarchical_memsw_limit # of bytes of memory+swap limit with regard to hierarchy under which memory cgroup is. total_ # hierarchical version of , which in addition to the cgroup's own value includes the sum of all hierarchical children's values of , i.e. total_cache ========================= =================================================== h](h)}(hAstatus considering hierarchy (see memory.use_hierarchy settings):h]hAstatus considering hierarchy (see memory.use_hierarchy settings):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubj+)}(hhh]j0)}(hhh](j5)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j4hjubj5)}(hhh]h}(h]h ]h"]h$]h&]colwidthK3uh1j4hjubjK)}(hhh](jP)}(hhh](jU)}(hhh]h)}(hhierarchical_memory_limith]hhierarchical_memory_limit}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(hT# of bytes of memory limit with regard to hierarchy under which the memory cgroup ish]hT# of bytes of memory limit with regard to hierarchy under which the memory cgroup is}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhj*ubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhj ubjP)}(hhh](jU)}(hhh]h)}(hhierarchical_memsw_limith]hhierarchical_memsw_limit}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjJubah}(h]h ]h"]h$]h&]uh1jThjGubjU)}(hhh]h)}(hV# of bytes of memory+swap limit with regard to hierarchy under which memory cgroup is.h]hV# of bytes of memory+swap limit with regard to hierarchy under which memory cgroup is.}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjaubah}(h]h ]h"]h$]h&]uh1jThjGubeh}(h]h ]h"]h$]h&]uh1jOhj ubjP)}(hhh](jU)}(hhh]h)}(htotal_h]htotal_}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubah}(h]h ]h"]h$]h&]uh1jThj~ubjU)}(hhh]h)}(h# hierarchical version of , which in addition to the cgroup's own value includes the sum of all hierarchical children's values of , i.e. total_cacheh]h# hierarchical version of , which in addition to the cgroup’s own value includes the sum of all hierarchical children’s values of , i.e. total_cache}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubah}(h]h ]h"]h$]h&]uh1jThj~ubeh}(h]h ]h"]h$]h&]uh1jOhj ubeh}(h]h ]h"]h$]h&]uh1jJhjubeh}(h]h ]h"]h$]h&]colsKuh1j/hjubah}(h]h ]h"]h$]h&]uh1j*hjubeh}(h]h ]h"]h$]h&]uh1jEhj]ubjF)}(hXadditional vm parameters (depends on CONFIG_DEBUG_VM): ========================= ======================================== recent_rotated_anon VM internal parameter. (see mm/vmscan.c) recent_rotated_file VM internal parameter. (see mm/vmscan.c) recent_scanned_anon VM internal parameter. (see mm/vmscan.c) recent_scanned_file VM internal parameter. (see mm/vmscan.c) ========================= ======================================== h](h)}(h6additional vm parameters (depends on CONFIG_DEBUG_VM):h]h6additional vm parameters (depends on CONFIG_DEBUG_VM):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjubj+)}(hhh]j0)}(hhh](j5)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j4hjubj5)}(hhh]h}(h]h ]h"]h$]h&]colwidthK(uh1j4hjubjK)}(hhh](jP)}(hhh](jU)}(hhh]h)}(hrecent_rotated_anonh]hrecent_rotated_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hrecent_rotated_fileh]hrecent_rotated_file}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMThj7ubah}(h]h ]h"]h$]h&]uh1jThj4ubjU)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMThjNubah}(h]h ]h"]h$]h&]uh1jThj4ubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hrecent_scanned_anonh]hrecent_scanned_anon}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhjnubah}(h]h ]h"]h$]h&]uh1jThjkubjU)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhjubah}(h]h ]h"]h$]h&]uh1jThjkubeh}(h]h ]h"]h$]h&]uh1jOhjubjP)}(hhh](jU)}(hhh]h)}(hrecent_scanned_fileh]hrecent_scanned_file}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhjubah}(h]h ]h"]h$]h&]uh1jThjubjU)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhjubah}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1jJhjubeh}(h]h ]h"]h$]h&]colsKuh1j/hjubah}(h]h ]h"]h$]h&]uh1j*hjubeh}(h]h ]h"]h$]h&]uh1jEhj]ubeh}(h]h ]h"]h$]h&]j*uh1jhhhM$hjYubah}(h]h ]h"]h$]h&]uh1jhhhM$hj:hhubh)}(hrecent_rotated means recent frequency of LRU rotation. recent_scanned means recent # of scans to LRU. showing for better debug please see the code for meanings.h]h)}(hrecent_rotated means recent frequency of LRU rotation. recent_scanned means recent # of scans to LRU. showing for better debug please see the code for meanings.h]hrecent_rotated means recent frequency of LRU rotation. recent_scanned means recent # of scans to LRU. showing for better debug please see the code for meanings.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjubah}(h]h ]h"]h$]h&]uh1hhj:hhhhhNubh)}(hXAOnly anonymous and swap cache memory is listed as part of 'rss' stat. This should not be confused with the true 'resident set size' or the amount of physical memory used by the cgroup. 'rss + mapped_file" will give you resident set size of cgroup. Note that some kernel configurations might account complete larger allocations (e.g., THP) towards 'rss' and 'mapped_file', even if only some, but not all that memory is mapped. (Note: file and shmem may be shared among other cgroups. In that case, mapped_file is accounted only when the memory cgroup is owner of page cache.)h](h)}(hOnly anonymous and swap cache memory is listed as part of 'rss' stat. This should not be confused with the true 'resident set size' or the amount of physical memory used by the cgroup.h]hOnly anonymous and swap cache memory is listed as part of ‘rss’ stat. This should not be confused with the true ‘resident set size’ or the amount of physical memory used by the cgroup.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hjubh)}(h>'rss + mapped_file" will give you resident set size of cgroup.h]hB‘rss + mapped_file” will give you resident set size of cgroup.}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMchjubh)}(hNote that some kernel configurations might account complete larger allocations (e.g., THP) towards 'rss' and 'mapped_file', even if only some, but not all that memory is mapped.h]hNote that some kernel configurations might account complete larger allocations (e.g., THP) towards ‘rss’ and ‘mapped_file’, even if only some, but not all that memory is mapped.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjubh)}(h(Note: file and shmem may be shared among other cgroups. In that case, mapped_file is accounted only when the memory cgroup is owner of page cache.)h]h(Note: file and shmem may be shared among other cgroups. In that case, mapped_file is accounted only when the memory cgroup is owner of page cache.)}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMihjubeh}(h]h ]h"]h$]h&]uh1hhj:hhhhhNubeh}(h] stat-fileah ]h"] 5.2 stat fileah$]h&]uh1hhjhhhhhM ubh)}(hhh](h)}(h5.3 swappinessh]h5.3 swappiness}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjahhhhhMnubh)}(hOverrides /proc/sys/vm/swappiness for the particular group. The tunable in the root cgroup corresponds to the global swappiness setting.h]hOverrides /proc/sys/vm/swappiness for the particular group. The tunable in the root cgroup corresponds to the global swappiness setting.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphjahhubh)}(hPlease note that unlike during the global reclaim, limit reclaim enforces that 0 swappiness really prevents from any swapping even if there is a swap storage available. This might lead to memcg OOM killer if there are no file pages to reclaim.h]hPlease note that unlike during the global reclaim, limit reclaim enforces that 0 swappiness really prevents from any swapping even if there is a swap storage available. This might lead to memcg OOM killer if there are no file pages to reclaim.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMshjahhubeh}(h] swappinessah ]h"]5.3 swappinessah$]h&]uh1hhjhhhhhMnubh)}(hhh](h)}(h 5.4 failcnth]h 5.4 failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMyubh)}(hXA memory cgroup provides memory.failcnt and memory.memsw.failcnt files. This failcnt(== failure count) shows the number of times that a usage counter hit its limit. When a memory cgroup hits a limit, failcnt increases and memory under it will be reclaimed.h]hXA memory cgroup provides memory.failcnt and memory.memsw.failcnt files. This failcnt(== failure count) shows the number of times that a usage counter hit its limit. When a memory cgroup hits a limit, failcnt increases and memory under it will be reclaimed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM{hjhhubh)}(h4You can reset failcnt by writing 0 to failcnt file::h]h3You can reset failcnt by writing 0 to failcnt file:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(h# echo 0 > .../memory.failcnth]h# echo 0 > .../memory.failcnt}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjhhubeh}(h]failcntah ]h"] 5.4 failcntah$]h&]uh1hhjhhhhhMyubh)}(hhh](h)}(h5.5 usage_in_bytesh]h5.5 usage_in_bytes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hXFor efficiency, as other kernel components, memory cgroup uses some optimization to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the method and doesn't show 'exact' value of memory (and swap) usage, it's a fuzz value for efficient access. (Of course, when necessary, it's synchronized.) If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP) value in memory.stat(see 5.2).h]hXFor efficiency, as other kernel components, memory cgroup uses some optimization to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the method and doesn’t show ‘exact’ value of memory (and swap) usage, it’s a fuzz value for efficient access. (Of course, when necessary, it’s synchronized.) If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP) value in memory.stat(see 5.2).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]usage-in-bytesah ]h"]5.5 usage_in_bytesah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h 5.6 numa_stath]h 5.6 numa_stat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hX`This is similar to numa_maps but operates on a per-memcg basis. This is useful for providing visibility into the numa locality information within an memcg since the pages are allowed to be allocated from any physical node. One of the use cases is evaluating application performance by combining this information with the application's CPU allocation.h]hXbThis is similar to numa_maps but operates on a per-memcg basis. This is useful for providing visibility into the numa locality information within an memcg since the pages are allowed to be allocated from any physical node. One of the use cases is evaluating application performance by combining this information with the application’s CPU allocation.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hEach memcg's numa_stat file includes "total", "file", "anon" and "unevictable" per-node page counts including "hierarchical_" which sums up all hierarchical children's values in addition to the memcg's own value.h]hEach memcg’s numa_stat file includes “total”, “file”, “anon” and “unevictable” per-node page counts including “hierarchical_” which sums up all hierarchical children’s values in addition to the memcg’s own value.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h*The output format of memory.numa_stat is::h]h)The output format of memory.numa_stat is:}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(hXQtotal= N0= N1= ... file= N0= N1= ... anon= N0= N1= ... unevictable= N0= N1= ... hierarchical_= N0= N1= ...h]hXQtotal= N0= N1= ... file= N0= N1= ... anon= N0= N1= ... unevictable= N0= N1= ... hierarchical_= N0= N1= ...}hj;sbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjhhubh)}(h6The "total" count is sum of file + anon + unevictable.h]h:The “total” count is sum of file + anon + unevictable.}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h] numa-statah ]h"] 5.6 numa_statah$]h&]uh1hhjhhhhhMubeh}(h]misc-interfacesah ]h"]5. misc. interfacesah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h6. Hierarchy supporth]h6. Hierarchy support}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjghhhhhMubh)}(hThe memory controller supports a deep hierarchy and hierarchical accounting. The hierarchy is created by creating the appropriate cgroups in the cgroup filesystem. Consider for example, the following cgroup filesystem hierarchy::h]hThe memory controller supports a deep hierarchy and hierarchical accounting. The hierarchy is created by creating the appropriate cgroups in the cgroup filesystem. Consider for example, the following cgroup filesystem hierarchy:}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjghhubj )}(h\ root / | \ / | \ a b c | \ | \ d eh]h\ root / | \ / | \ a b c | \ | \ d e}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjghhubh)}(hX"In the diagram above, with hierarchical accounting enabled, all memory usage of e, is accounted to its ancestors up until the root (i.e, c and root). If one of the ancestors goes over its limit, the reclaim algorithm reclaims from the tasks in the ancestor and the children of the ancestor.h]hX"In the diagram above, with hierarchical accounting enabled, all memory usage of e, is accounted to its ancestors up until the root (i.e, c and root). If one of the ancestors goes over its limit, the reclaim algorithm reclaims from the tasks in the ancestor and the children of the ancestor.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjghhubh)}(hhh](h)}(h'6.1 Hierarchical accounting and reclaimh]h'6.1 Hierarchical accounting and reclaim}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hHierarchical accounting is enabled by default. Disabling the hierarchical accounting is deprecated. An attempt to do it will result in a failure and a warning printed to dmesg.h]hHierarchical accounting is enabled by default. Disabling the hierarchical accounting is deprecated. An attempt to do it will result in a failure and a warning printed to dmesg.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hNFor compatibility reasons writing 1 to memory.use_hierarchy will always pass::h]hMFor compatibility reasons writing 1 to memory.use_hierarchy will always pass:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(h# echo 1 > memory.use_hierarchyh]h# echo 1 > memory.use_hierarchy}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjhhubeh}(h]#hierarchical-accounting-and-reclaimah ]h"]'6.1 hierarchical accounting and reclaimah$]h&]uh1hhjghhhhhMubeh}(h]hierarchy-supportah ]h"]6. hierarchy supportah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h7. Soft limits (DEPRECATED)h]h7. Soft limits (DEPRECATED)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hSoft limits allow for greater sharing of memory. The idea behind soft limits is to allow control groups to use as much of the memory as needed, providedh]hSoft limits allow for greater sharing of memory. The idea behind soft limits is to allow control groups to use as much of the memory as needed, provided}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjA)}(hhh](jF)}(hThere is no memory contentionh]h)}(hjh]hThere is no memory contention}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jEhjhhhhhNubjF)}(h$They do not exceed their hard limit h]h)}(h#They do not exceed their hard limith]h#They do not exceed their hard limit}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj4ubah}(h]h ]h"]h$]h&]uh1jEhjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1j@hjhhhhhMubh)}(hXWhen the system detects memory contention or low memory, control groups are pushed back to their soft limits. If the soft limit of each control group is very high, they are pushed back as much as possible to make sure that one control group does not starve the others of memory.h]hXWhen the system detects memory contention or low memory, control groups are pushed back to their soft limits. If the soft limit of each control group is very high, they are pushed back as much as possible to make sure that one control group does not starve the others of memory.}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hX=Please note that soft limits is a best-effort feature; it comes with no guarantees, but it does its best to make sure that when memory is heavily contended for, memory is allocated based on the soft limit hints/setup. Currently soft limit based reclaim is set up such that it gets invoked from balance_pgdat (kswapd).h]hX=Please note that soft limits is a best-effort feature; it comes with no guarantees, but it does its best to make sure that when memory is heavily contended for, memory is allocated based on the soft limit hints/setup. Currently soft limit based reclaim is set up such that it gets invoked from balance_pgdat (kswapd).}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hhh](h)}(h 7.1 Interfaceh]h 7.1 Interface}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjnhhhhhMubh)}(hnSoft limits can be setup by using the following commands (in this example we assume a soft limit of 256 MiB)::h]hmSoft limits can be setup by using the following commands (in this example we assume a soft limit of 256 MiB):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjnhhubj )}(h(# echo 256M > memory.soft_limit_in_bytesh]h(# echo 256M > memory.soft_limit_in_bytes}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjnhhubh)}(h9If we want to change this to 1G, we can at any time use::h]h8If we want to change this to 1G, we can at any time use:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjnhhubj )}(h&# echo 1G > memory.soft_limit_in_bytesh]h&# echo 1G > memory.soft_limit_in_bytes}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjnhhubh)}(h}Soft limits take effect over a long period of time, since they involve reclaiming memory for balancing between memory cgroupsh]h)}(h}Soft limits take effect over a long period of time, since they involve reclaiming memory for balancing between memory cgroupsh]h}Soft limits take effect over a long period of time, since they involve reclaiming memory for balancing between memory cgroups}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjnhhhhhNubh)}(hsIt is recommended to set the soft limit always below the hard limit, otherwise the hard limit will take precedence.h]h)}(hsIt is recommended to set the soft limit always below the hard limit, otherwise the hard limit will take precedence.h]hsIt is recommended to set the soft limit always below the hard limit, otherwise the hard limit will take precedence.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjnhhhhhNubj )}(h".. _cgroup-v1-memory-move-charges:h]h}(h]h ]h"]h$]h&]j1cgroup-v1-memory-move-chargesuh1j hMhjnhhhhubeh}(h] interfaceah ]h"] 7.1 interfaceah$]h&]uh1hhjhhhhhMubeh}(h]soft-limits-deprecatedah ]h"]7. soft limits (deprecated)ah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h/8. Move charges at task migration (DEPRECATED!)h]h/8. Move charges at task migration (DEPRECATED!)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hjReading memory.move_charge_at_immigrate will always return 0 and writing to it will always return -EINVAL.h]hjReading memory.move_charge_at_immigrate will always return 0 and writing to it will always return -EINVAL.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]()move-charges-at-task-migration-deprecatedjeh ]h"](/8. move charges at task migration (deprecated!)cgroup-v1-memory-move-chargeseh$]h&]uh1hhhhhhhhMjr}j5jsjt}jjsubh)}(hhh](h)}(h9. Memory thresholdsh]h9. Memory thresholds}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:hhhhhMubh)}(hMemory cgroup implements memory thresholds using the cgroups notification API (see cgroups.txt). It allows to register multiple memory and memsw thresholds and gets notifications when it crosses.h]hMemory cgroup implements memory thresholds using the cgroups notification API (see cgroups.txt). It allows to register multiple memory and memsw thresholds and gets notifications when it crosses.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:hhubh)}(h-To register a threshold, an application must:h]h-To register a threshold, an application must:}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:hhubj)}(hhh](jF)}(h#create an eventfd using eventfd(2);h]h)}(hjlh]h#create an eventfd using eventfd(2);}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjjubah}(h]h ]h"]h$]h&]uh1jEhjghhhhhNubjF)}(h:open memory.usage_in_bytes or memory.memsw.usage_in_bytes;h]h)}(hjh]h:open memory.usage_in_bytes or memory.memsw.usage_in_bytes;}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jEhjghhhhhNubjF)}(hbwrite string like " " to cgroup.event_control. h]h)}(hawrite string like " " to cgroup.event_control.h]hewrite string like “ ” to cgroup.event_control.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jEhjghhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj:hhubh)}(hbApplication will be notified through eventfd when memory usage crosses threshold in any direction.h]hbApplication will be notified through eventfd when memory usage crosses threshold in any direction.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj:hhubh)}(h-It's applicable for root and non-root cgroup.h]h/It’s applicable for root and non-root cgroup.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj:hhubj )}(h!.. _cgroup-v1-memory-oom-control:h]h}(h]h ]h"]h$]h&]j1cgroup-v1-memory-oom-controluh1j hM hj:hhhhubeh}(h]memory-thresholdsah ]h"]9. memory thresholdsah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h10. OOM Control (DEPRECATED)h]h10. OOM Control (DEPRECATED)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hCmemory.oom_control file is for OOM notification and other controls.h]hCmemory.oom_control file is for OOM notification and other controls.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hMemory cgroup implements OOM notifier using the cgroup notification API (See cgroups.txt). It allows to register multiple OOM notification delivery and gets notification when OOM happens.h]hMemory cgroup implements OOM notifier using the cgroup notification API (See cgroups.txt). It allows to register multiple OOM notification delivery and gets notification when OOM happens.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h,To register a notifier, an application must:h]h,To register a notifier, an application must:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h- create an eventfd using eventfd(2) - open memory.oom_control file - write string like " " to cgroup.event_control h]j)}(hhh](jF)}(h"create an eventfd using eventfd(2)h]h)}(hj7h]h"create an eventfd using eventfd(2)}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj5ubah}(h]h ]h"]h$]h&]uh1jEhj2ubjF)}(hopen memory.oom_control fileh]h)}(hjNh]hopen memory.oom_control file}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubah}(h]h ]h"]h$]h&]uh1jEhj2ubjF)}(hRwrite string like " " to cgroup.event_control h]h)}(hQwrite string like " " to cgroup.event_controlh]hUwrite string like “ ” to cgroup.event_control}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jEhj2ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhj.ubah}(h]h ]h"]h$]h&]uh1jhhhMhjhhubh)}(huThe application will be notified through eventfd when OOM happens. OOM notification doesn't work for the root cgroup.h]hwThe application will be notified through eventfd when OOM happens. OOM notification doesn’t work for the root cgroup.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjhhubh)}(hMYou can disable the OOM-killer by writing "1" to memory.oom_control file, as:h]hQYou can disable the OOM-killer by writing “1” to memory.oom_control file, as:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM#hjhhubj)}(h#echo 1 > memory.oom_control h]h)}(h#echo 1 > memory.oom_controlh]h#echo 1 > memory.oom_control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hjubah}(h]h ]h"]h$]h&]uh1jhhhM%hjhhubh)}(hIf OOM-killer is disabled, tasks under cgroup will hang/sleep in memory cgroup's OOM-waitqueue when they request accountable memory.h]hIf OOM-killer is disabled, tasks under cgroup will hang/sleep in memory cgroup’s OOM-waitqueue when they request accountable memory.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hjhhubh)}(hEFor running them, you have to relax the memory cgroup's OOM status byh]hGFor running them, you have to relax the memory cgroup’s OOM status by}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM*hjhhubj)}(h!* enlarge limit or reduce usage. h]j)}(hhh]jF)}(henlarge limit or reduce usage. h]h)}(henlarge limit or reduce usage.h]henlarge limit or reduce usage.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjubah}(h]h ]h"]h$]h&]uh1jEhjubah}(h]h ]h"]h$]h&]jjuh1jhhhM,hjubah}(h]h ]h"]h$]h&]uh1jhhhM,hjhhubh)}(hTo reduce usage,h]hTo reduce usage,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjhhubj)}(hl* kill some tasks. * move some tasks to other group with account migration. * remove some files (on tmpfs?) h]j)}(hhh](jF)}(hkill some tasks.h]h)}(hjh]hkill some tasks.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM0hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(h6move some tasks to other group with account migration.h]h)}(hj0h]h6move some tasks to other group with account migration.}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM1hj.ubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(hremove some files (on tmpfs?) h]h)}(hremove some files (on tmpfs?)h]hremove some files (on tmpfs?)}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hjEubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhM0hjubah}(h]h ]h"]h$]h&]uh1jhhhM0hjhhubh)}(h$Then, stopped tasks will work again.h]h$Then, stopped tasks will work again.}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjhhubh)}(h+At reading, current status of OOM is shown.h]h+At reading, current status of OOM is shown.|}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjhhubj)}(hX- oom_kill_disable 0 or 1 (if 1, oom-killer is disabled) - under_oom 0 or 1 (if 1, the memory cgroup is under OOM, tasks may be stopped.) - oom_kill integer counter The number of processes belonging to this cgroup killed by any kind of OOM killer. h]j)}(hhh](jF)}(h6oom_kill_disable 0 or 1 (if 1, oom-killer is disabled)h]h)}(h6oom_kill_disable 0 or 1 (if 1, oom-killer is disabled)h]h6oom_kill_disable 0 or 1 (if 1, oom-killer is disabled)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(hUunder_oom 0 or 1 (if 1, the memory cgroup is under OOM, tasks may be stopped.)h]h)}(hUunder_oom 0 or 1 (if 1, the memory cgroup is under OOM, tasks may be stopped.)h]hUunder_oom 0 or 1 (if 1, the memory cgroup is under OOM, tasks may be stopped.)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hjubah}(h]h ]h"]h$]h&]uh1jEhjubjF)}(htoom_kill integer counter The number of processes belonging to this cgroup killed by any kind of OOM killer. h]h)}(hsoom_kill integer counter The number of processes belonging to this cgroup killed by any kind of OOM killer.h]hsoom_kill integer counter The number of processes belonging to this cgroup killed by any kind of OOM killer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hjubah}(h]h ]h"]h$]h&]uh1jEhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhM8hjubah}(h]h ]h"]h$]h&]uh1jhhhM8hjhhubeh}(h](oom-control-deprecatedjeh ]h"](10. oom control (deprecated)cgroup-v1-memory-oom-controleh$]h&]uh1hhhhhhhhMjr}jjsjt}jjsubh)}(hhh](h)}(h 11. Memory Pressure (DEPRECATED)h]h 11. Memory Pressure (DEPRECATED)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMAubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMChjhhubh)}(hThe pressure level notifications can be used to monitor the memory allocation cost; based on the pressure, applications can implement different strategies of managing their memory resources. The pressure levels are defined as following:h]hThe pressure level notifications can be used to monitor the memory allocation cost; based on the pressure, applications can implement different strategies of managing their memory resources. The pressure levels are defined as following:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMEhjhhubh)}(hX8The "low" level means that the system is reclaiming memory for new allocations. Monitoring this reclaiming activity might be useful for maintaining cache level. Upon notification, the program (typically "Activity Manager") might analyze vmstat and act in advance (i.e. prematurely shutdown unimportant services).h]hX@The “low” level means that the system is reclaiming memory for new allocations. Monitoring this reclaiming activity might be useful for maintaining cache level. Upon notification, the program (typically “Activity Manager”) might analyze vmstat and act in advance (i.e. prematurely shutdown unimportant services).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjhhubh)}(hXZThe "medium" level means that the system is experiencing medium memory pressure, the system might be making swap, paging out active file caches, etc. Upon this event applications may decide to further analyze vmstat/zoneinfo/memcg or internal memory usage statistics and free any resources that can be easily reconstructed or re-read from a disk.h]hX^The “medium” level means that the system is experiencing medium memory pressure, the system might be making swap, paging out active file caches, etc. Upon this event applications may decide to further analyze vmstat/zoneinfo/memcg or internal memory usage statistics and free any resources that can be easily reconstructed or re-read from a disk.}(hj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjhhubh)}(hXPThe "critical" level means that the system is actively thrashing, it is about to out of memory (OOM) or even the in-kernel OOM killer is on its way to trigger. Applications should do whatever they can to help the system. It might be too late to consult with vmstat or any other statistics, so it's advisable to take an immediate action.h]hXVThe “critical” level means that the system is actively thrashing, it is about to out of memory (OOM) or even the in-kernel OOM killer is on its way to trigger. Applications should do whatever they can to help the system. It might be too late to consult with vmstat or any other statistics, so it’s advisable to take an immediate action.}(hj4 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhjhhubh)}(hXTBy default, events are propagated upward until the event is handled, i.e. the events are not pass-through. For example, you have three cgroups: A->B->C. Now you set up an event listener on cgroups A, B and C, and suppose group C experiences some pressure. In this situation, only group C will receive the notification, i.e. groups A and B will not receive it. This is done to avoid excessive "broadcasting" of messages, which disturbs the system and which is especially bad if we are low on memory or thrashing. Group B, will receive notification only if there are no event listeners for group C.h]hXXBy default, events are propagated upward until the event is handled, i.e. the events are not pass-through. For example, you have three cgroups: A->B->C. Now you set up an event listener on cgroups A, B and C, and suppose group C experiences some pressure. In this situation, only group C will receive the notification, i.e. groups A and B will not receive it. This is done to avoid excessive “broadcasting” of messages, which disturbs the system and which is especially bad if we are low on memory or thrashing. Group B, will receive notification only if there are no event listeners for group C.}(hjB hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM\hjhhubh)}(hKThere are three optional modes that specify different propagation behavior:h]hKThere are three optional modes that specify different propagation behavior:}(hjP hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjhhubj)}(hX- "default": this is the default behavior specified above. This mode is the same as omitting the optional mode parameter, preserved by backwards compatibility. - "hierarchy": events always propagate up to the root, similar to the default behavior, except that propagation continues regardless of whether there are event listeners at each level, with the "hierarchy" mode. In the above example, groups A, B, and C will receive notification of memory pressure. - "local": events are pass-through, i.e. they only receive notifications when memory pressure is experienced in the memcg for which the notification is registered. In the above example, group C will receive notification if registered for "local" notification and the group experiences memory pressure. However, group B will never receive notification, regardless if there is an event listener for group C or not, if group B is registered for local notification. h]j)}(hhh](jF)}(h"default": this is the default behavior specified above. This mode is the same as omitting the optional mode parameter, preserved by backwards compatibility. h]h)}(h"default": this is the default behavior specified above. This mode is the same as omitting the optional mode parameter, preserved by backwards compatibility.h]h“default”: this is the default behavior specified above. This mode is the same as omitting the optional mode parameter, preserved by backwards compatibility.}(hji hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMghje ubah}(h]h ]h"]h$]h&]uh1jEhjb ubjF)}(hX)"hierarchy": events always propagate up to the root, similar to the default behavior, except that propagation continues regardless of whether there are event listeners at each level, with the "hierarchy" mode. In the above example, groups A, B, and C will receive notification of memory pressure. h]h)}(hX("hierarchy": events always propagate up to the root, similar to the default behavior, except that propagation continues regardless of whether there are event listeners at each level, with the "hierarchy" mode. In the above example, groups A, B, and C will receive notification of memory pressure.h]hX0“hierarchy”: events always propagate up to the root, similar to the default behavior, except that propagation continues regardless of whether there are event listeners at each level, with the “hierarchy” mode. In the above example, groups A, B, and C will receive notification of memory pressure.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMkhj} ubah}(h]h ]h"]h$]h&]uh1jEhjb ubjF)}(hX"local": events are pass-through, i.e. they only receive notifications when memory pressure is experienced in the memcg for which the notification is registered. In the above example, group C will receive notification if registered for "local" notification and the group experiences memory pressure. However, group B will never receive notification, regardless if there is an event listener for group C or not, if group B is registered for local notification. h]h)}(hX"local": events are pass-through, i.e. they only receive notifications when memory pressure is experienced in the memcg for which the notification is registered. In the above example, group C will receive notification if registered for "local" notification and the group experiences memory pressure. However, group B will never receive notification, regardless if there is an event listener for group C or not, if group B is registered for local notification.h]hX“local”: events are pass-through, i.e. they only receive notifications when memory pressure is experienced in the memcg for which the notification is registered. In the above example, group C will receive notification if registered for “local” notification and the group experiences memory pressure. However, group B will never receive notification, regardless if there is an event listener for group C or not, if group B is registered for local notification.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphj ubah}(h]h ]h"]h$]h&]uh1jEhjb ubeh}(h]h ]h"]h$]h&]jjuh1jhhhMghj^ ubah}(h]h ]h"]h$]h&]uh1jhhhMghjhhubh)}(hXwThe level and event notification mode ("hierarchy" or "local", if necessary) are specified by a comma-delimited string, i.e. "low,hierarchy" specifies hierarchical, pass-through, notification for all ancestor memcgs. Notification that is the default, non pass-through behavior, does not specify a mode. "medium,local" specifies pass-through notification for the medium level.h]hXThe level and event notification mode (“hierarchy” or “local”, if necessary) are specified by a comma-delimited string, i.e. “low,hierarchy” specifies hierarchical, pass-through, notification for all ancestor memcgs. Notification that is the default, non pass-through behavior, does not specify a mode. “medium,local” specifies pass-through notification for the medium level.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhjhhubh)}(hqThe file memory.pressure_level is only used to setup an eventfd. To register a notification, an application must:h]hqThe file memory.pressure_level is only used to setup an eventfd. To register a notification, an application must:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM~hjhhubj)}(hhh](jF)}(h#create an eventfd using eventfd(2);h]h)}(hj h]h#create an eventfd using eventfd(2);}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jEhj hhhhhNubjF)}(hopen memory.pressure_level;h]h)}(hj h]hopen memory.pressure_level;}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jEhj hhhhhNubjF)}(hcwrite string as " " to cgroup.event_control. h]h)}(hbwrite string as " " to cgroup.event_control.h]hfwrite string as “ ” to cgroup.event_control.}(hj !hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jEhj hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjhhubh)}(hApplication will be notified through eventfd when memory pressure is at the specific level (or higher). Read/write operations to memory.pressure_level are no implemented.h]hApplication will be notified through eventfd when memory pressure is at the specific level (or higher). Read/write operations to memory.pressure_level are no implemented.}(hj$!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hTest:h]hTest:}(hj2!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hXHere is a small script example that makes a new cgroup, sets up a memory limit, sets up a notification in the cgroup and then makes child cgroup experience a critical pressure:: # cd /sys/fs/cgroup/memory/ # mkdir foo # cd foo # cgroup_event_listener memory.pressure_level low,hierarchy & # echo 8000000 > memory.limit_in_bytes # echo 8000000 > memory.memsw.limit_in_bytes # echo $$ > tasks # dd if=/dev/zero | read x (Expect a bunch of notifications, and eventually, the oom-killer will trigger.) h](h)}(hHere is a small script example that makes a new cgroup, sets up a memory limit, sets up a notification in the cgroup and then makes child cgroup experience a critical pressure::h]hHere is a small script example that makes a new cgroup, sets up a memory limit, sets up a notification in the cgroup and then makes child cgroup experience a critical pressure:}(hjD!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj@!ubj )}(h# cd /sys/fs/cgroup/memory/ # mkdir foo # cd foo # cgroup_event_listener memory.pressure_level low,hierarchy & # echo 8000000 > memory.limit_in_bytes # echo 8000000 > memory.memsw.limit_in_bytes # echo $$ > tasks # dd if=/dev/zero | read xh]h# cd /sys/fs/cgroup/memory/ # mkdir foo # cd foo # cgroup_event_listener memory.pressure_level low,hierarchy & # echo 8000000 > memory.limit_in_bytes # echo 8000000 > memory.memsw.limit_in_bytes # echo $$ > tasks # dd if=/dev/zero | read x}hjR!sbah}(h]h ]h"]h$]h&]j j uh1j hhhMhj@!ubh)}(hO(Expect a bunch of notifications, and eventually, the oom-killer will trigger.)h]hO(Expect a bunch of notifications, and eventually, the oom-killer will trigger.)}(hj`!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj@!ubeh}(h]h ]h"]h$]h&]uh1jhhhMhjhhubeh}(h]memory-pressure-deprecatedah ]h"] 11. memory pressure (deprecated)ah$]h&]uh1hhhhhhhhMAubh)}(hhh](h)}(h12. TODOh]h12. TODO}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj|!hhhhhMubjA)}(hhh](jF)}(h6Make per-cgroup scanner reclaim not-shared pages firsth]h)}(hj!h]h6Make per-cgroup scanner reclaim not-shared pages first}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jEhj!hhhhhNubjF)}(h,Teach controller to account for shared-pagesh]h)}(hj!h]h,Teach controller to account for shared-pages}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jEhj!hhhhhNubjF)}(hbStart reclamation in the background when the limit is not yet hit but the usage is getting closer h]h)}(haStart reclamation in the background when the limit is not yet hit but the usage is getting closerh]haStart reclamation in the background when the limit is not yet hit but the usage is getting closer}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj!ubah}(h]h ]h"]h$]h&]uh1jEhj!hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1j@hj|!hhhhhMubeh}(h]todoah ]h"]12. todoah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(hSummaryh]hSummary}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj!hhhhhMubh)}(hOverall, the memory controller has been a stable controller and has been commented and discussed quite extensively in the community.h]hOverall, the memory controller has been a stable controller and has been commented and discussed quite extensively in the community.}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj!hhubeh}(h]summaryah ]h"]summaryah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h Referencesh]h References}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj "hhhhhMubhfootnote)}(hFSingh, Balbir. RFC: Memory Controller, http://lwn.net/Articles/206697/h](hlabel)}(h1h]h1}(hj$"hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj"ubh)}(hj "h](h'Singh, Balbir. RFC: Memory Controller, }(hj2"hhhNhNubh reference)}(hhttp://lwn.net/Articles/206697/h]hhttp://lwn.net/Articles/206697/}(hj;"hhhNhNubah}(h]h ]h"]h$]h&]refurij="uh1j9"hj2"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubeh}(h]j ah ]h"]1ah$]h&]j aj3j4uh1j"hhhMhj "hhj5Kubj")}(hOSingh, Balbir. Memory Controller (RSS Control), http://lwn.net/Articles/222762/h](j#")}(h2h]h2}(hj["hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hjW"ubh)}(hOSingh, Balbir. Memory Controller (RSS Control), http://lwn.net/Articles/222762/h](h0Singh, Balbir. Memory Controller (RSS Control), }(hji"hhhNhNubj:")}(hhttp://lwn.net/Articles/222762/h]hhttp://lwn.net/Articles/222762/}(hjq"hhhNhNubah}(h]h ]h"]h$]h&]refurijs"uh1j9"hji"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjW"ubeh}(h]j ah ]h"]2ah$]h&]j aj3j4uh1j"hhhMhj "hhj5Kubj")}(hpEmelianov, Pavel. Resource controllers based on process cgroups https://lore.kernel.org/r/45ED7DEC.7010403@sw.ruh](j#")}(h3h]h3}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj"ubh)}(hpEmelianov, Pavel. Resource controllers based on process cgroups https://lore.kernel.org/r/45ED7DEC.7010403@sw.ruh](h@Emelianov, Pavel. Resource controllers based on process cgroups }(hj"hhhNhNubj:")}(h0https://lore.kernel.org/r/45ED7DEC.7010403@sw.ruh]h0https://lore.kernel.org/r/45ED7DEC.7010403@sw.ru}(hj"hhhNhNubah}(h]h ]h"]h$]h&]refurij"uh1j9"hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubeh}(h]j ah ]h"]3ah$]h&]j aj3j4uh1j"hhhMhj "hhj5Kubj")}(hmEmelianov, Pavel. RSS controller based on process cgroups (v2) https://lore.kernel.org/r/461A3010.90403@sw.ruh](j#")}(h4h]h4}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj"ubh)}(hmEmelianov, Pavel. RSS controller based on process cgroups (v2) https://lore.kernel.org/r/461A3010.90403@sw.ruh](h?Emelianov, Pavel. RSS controller based on process cgroups (v2) }(hj"hhhNhNubj:")}(h.https://lore.kernel.org/r/461A3010.90403@sw.ruh]h.https://lore.kernel.org/r/461A3010.90403@sw.ru}(hj"hhhNhNubah}(h]h ]h"]h$]h&]refurij"uh1j9"hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubeh}(h]j ah ]h"]4ah$]h&]j aj3j4uh1j"hhhMhj "hhj5Kubj")}(huEmelianov, Pavel. RSS controller based on process cgroups (v3) https://lore.kernel.org/r/465D9739.8070209@openvz.org h](j#")}(h5h]h5}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj"ubh)}(htEmelianov, Pavel. RSS controller based on process cgroups (v3) https://lore.kernel.org/r/465D9739.8070209@openvz.orgh](h?Emelianov, Pavel. RSS controller based on process cgroups (v3) }(hj #hhhNhNubj:")}(h5https://lore.kernel.org/r/465D9739.8070209@openvz.orgh]h5https://lore.kernel.org/r/465D9739.8070209@openvz.org}(hj#hhhNhNubah}(h]h ]h"]h$]h&]refurij#uh1j9"hj #ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubeh}(h]j ah ]h"]5ah$]h&]j aj3j4uh1j"hhhMhj "hhj5KubjA)}(hhh](jF)}(hAMenage, Paul. Control Groups v10, http://lwn.net/Articles/236032/h]h)}(hj4#h](h"Menage, Paul. Control Groups v10, }(hj6#hhhNhNubj:")}(hhttp://lwn.net/Articles/236032/h]hhttp://lwn.net/Articles/236032/}(hj=#hhhNhNubah}(h]h ]h"]h$]h&]refurij?#uh1j9"hj6#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj2#ubah}(h]h ]h"]h$]h&]uh1jEhj/#hhhhhNubjF)}(hzVaidyanathan, Srinivasan, Control Groups: Pagecache accounting and control subsystem (v3), http://lwn.net/Articles/235534/h]h)}(hzVaidyanathan, Srinivasan, Control Groups: Pagecache accounting and control subsystem (v3), http://lwn.net/Articles/235534/h](h[Vaidyanathan, Srinivasan, Control Groups: Pagecache accounting and control subsystem (v3), }(hj\#hhhNhNubj:")}(hhttp://lwn.net/Articles/235534/h]hhttp://lwn.net/Articles/235534/}(hjd#hhhNhNubah}(h]h ]h"]h$]h&]refurijf#uh1j9"hj\#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjX#ubah}(h]h ]h"]h$]h&]uh1jEhj/#hhhhhNubjF)}(hvSingh, Balbir. RSS controller v2 test results (lmbench), https://lore.kernel.org/r/464C95D4.7070806@linux.vnet.ibm.comh]h)}(hvSingh, Balbir. RSS controller v2 test results (lmbench), https://lore.kernel.org/r/464C95D4.7070806@linux.vnet.ibm.comh](h9Singh, Balbir. RSS controller v2 test results (lmbench), }(hj#hhhNhNubj:")}(h=https://lore.kernel.org/r/464C95D4.7070806@linux.vnet.ibm.comh]h=https://lore.kernel.org/r/464C95D4.7070806@linux.vnet.ibm.com}(hj#hhhNhNubah}(h]h ]h"]h$]h&]refurij#uh1j9"hj#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj#ubah}(h]h ]h"]h$]h&]uh1jEhj/#hhhhhNubjF)}(hiSingh, Balbir. RSS controller v2 AIM9 results https://lore.kernel.org/r/464D267A.50107@linux.vnet.ibm.comh]h)}(hiSingh, Balbir. RSS controller v2 AIM9 results https://lore.kernel.org/r/464D267A.50107@linux.vnet.ibm.comh](h.Singh, Balbir. RSS controller v2 AIM9 results }(hj#hhhNhNubj:")}(h;https://lore.kernel.org/r/464D267A.50107@linux.vnet.ibm.comh]h;https://lore.kernel.org/r/464D267A.50107@linux.vnet.ibm.com}(hj#hhhNhNubah}(h]h ]h"]h$]h&]refurij#uh1j9"hj#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj#ubah}(h]h ]h"]h$]h&]uh1jEhj/#hhhhhNubjF)}(hSingh, Balbir. Memory controller v6 test results, https://lore.kernel.org/r/20070819094658.654.84837.sendpatchset@balbir-laptop h]h)}(hSingh, Balbir. Memory controller v6 test results, https://lore.kernel.org/r/20070819094658.654.84837.sendpatchset@balbir-laptoph](h2Singh, Balbir. Memory controller v6 test results, }(hj#hhhNhNubj:")}(hMhttps://lore.kernel.org/r/20070819094658.654.84837.sendpatchset@balbir-laptoph]hMhttps://lore.kernel.org/r/20070819094658.654.84837.sendpatchset@balbir-laptop}(hj#hhhNhNubah}(h]h ]h"]h$]h&]refurij#uh1j9"hj#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj#ubah}(h]h ]h"]h$]h&]uh1jEhj/#hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjstartKuh1j@hj "hhhhhMubj")}(hSingh, Balbir. Memory controller introduction (v6), https://lore.kernel.org/r/20070817084228.26003.12568.sendpatchset@balbir-laptoph](j#")}(h11h]h11}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj#ubh)}(hSingh, Balbir. Memory controller introduction (v6), https://lore.kernel.org/r/20070817084228.26003.12568.sendpatchset@balbir-laptoph](h4Singh, Balbir. Memory controller introduction (v6), }(hj $hhhNhNubj:")}(hOhttps://lore.kernel.org/r/20070817084228.26003.12568.sendpatchset@balbir-laptoph]hOhttps://lore.kernel.org/r/20070817084228.26003.12568.sendpatchset@balbir-laptop}(hj$hhhNhNubah}(h]h ]h"]h$]h&]refurij$uh1j9"hj $ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj#ubeh}(h]j ah ]h"]11ah$]h&]j aj3j4uh1j"hhhMhj "hhj5Kubj")}(hTCorbet, Jonathan, Controlling memory use in cgroups, http://lwn.net/Articles/243795/h](j#")}(h12h]h12}(hj5$hhhNhNubah}(h]h ]h"]h$]h&]uh1j""hj1$ubh)}(hTCorbet, Jonathan, Controlling memory use in cgroups, http://lwn.net/Articles/243795/h](h5Corbet, Jonathan, Controlling memory use in cgroups, }(hjC$hhhNhNubj:")}(hhttp://lwn.net/Articles/243795/h]hhttp://lwn.net/Articles/243795/}(hjK$hhhNhNubah}(h]h ]h"]h$]h&]refurijM$uh1j9"hjC$ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj1$ubeh}(h]j2ah ]h"]12ah$]h&]j,aj3j4uh1j"hhhMhj "hhj5Kubeh}(h] referencesah ]h"] referencesah$]h&]uh1hhhhhhhhMubeh}(h]memory-resource-controllerah ]h"]memory resource controllerah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjTfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj$error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}(12]j"a1]j a2]j a3]j a4]j a5]j a11]j aurefids}(j ]j aj5]j+aj]jaj]jaj]jaunameids}(jt$jq$jo jl j j j8j5j j j j j j j$ j! j j j j j j j j jj joj jnjkjYjVj0j-jjjjjj5jjj6jj5j2jjjdjaj7j4j^j[jjjjjjj\jYjjjjjjjjj5jj4j1jjjjjjjy!jv!j!j!j"j"jl$ji$jT"j j"j j"j j"j j,#j j.$j jd$j2u nametypes}(jt$jo j j8j j j j$ j j j j jjojnjYj0jjjjj6j5jjdj7j^jjjj\jjjjj5j4jjjjy!j!j"jl$jT"j"j"j"j,#j.$jd$uh}(jq$hjl jj,j"j jr j j j j j j j j j j j j j5j j j j j j j j! j j j' j j j j j j j j j jjkjjVjvj-j\jj;jjj5j6jj6jjj2jjj;jajj4jj[j:jjajjjjjYjjjgjjjjjjnjjj1jjj:jjjjjv!jj!j|!j"j!ji$j "j j"j jW"j j"j j"j j"j j#j2j1$j j u footnote_refs}(j$]j"aj$]j aj$]j aj$]j aj$]j aj$]j aj$]j au citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes](j"jW"j"j"j"j#j1$e citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}j$KsRparse_messages]hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "6" (ordinal 6)h]h>Enumerated list start value not ordinal-1: “6” (ordinal 6)}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j%hj "hhhhhMubatransform_messages](j%)}(hhh]h)}(hhh]hGHyperlink target "cgroup-v1-memory-kernel-extension" is not referenced.}hj8%sbah}(h]h ]h"]h$]h&]uh1hhj5%ubah}(h]h ]h"]h$]h&]levelKtypej0%sourcehlineMBuh1j%ubj%)}(hhh]h)}(hhh]hHHyperlink target "cgroup-v1-memory-test-troubleshoot" is not referenced.}hjR%sbah}(h]h ]h"]h$]h&]uh1hhjO%ubah}(h]h ]h"]h$]h&]levelKtypej0%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]hJHyperlink target "cgroup-v1-memory-test-task-migration" is not referenced.}hjl%sbah}(h]h ]h"]h$]h&]uh1hhji%ubah}(h]h ]h"]h$]h&]levelKtypej0%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]hCHyperlink target "cgroup-v1-memory-move-charges" is not referenced.}hj%sbah}(h]h ]h"]h$]h&]uh1hhj%ubah}(h]h ]h"]h$]h&]levelKtypej0%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]hBHyperlink target "cgroup-v1-memory-oom-control" is not referenced.}hj%sbah}(h]h ]h"]h$]h&]uh1hhj%ubah}(h]h ]h"]h$]h&]levelKtypej0%sourcehlineM uh1j%ube transformerN include_log] decorationNhhub.