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]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/pt_BR/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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhhhhhNubh)}(hhh](h)}(h-Benefits and Purpose of the memory controllerh]h-Benefits and Purpose of the memory controller}(hjhhhNhNubah}(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 }(hj,hhhNhNubhfootnote_reference)}(h[12]_h]h12}(hj6hhhNhNubah}(h]id1ah ]h"]h$]h&]refidid14docnameadmin-guide/cgroup-v1/memoryuh1j4hj,resolvedKubh[ mentions some probable uses of the memory controller. The memory controller can be used to}(hj,hhhNhNubeh}(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.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj[ubah}(h]h ]h"]h$]h&]uh1jYhjVhhhhhNubjZ)}(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.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjsubah}(h]h ]h"]h$]h&]uh1jYhjVhhhhhNubjZ)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjubah}(h]h ]h"]h$]h&]uh1jYhjVhhhhhNubjZ)}(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&]uh1jYhjVhhhhhNubjZ)}(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&]uh1jYhjVhhhhhNubeh}(h]h ]h"]h$]h&]enumtype loweralphaprefixhsuffix.uh1jThjhhhhhKubh)}(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)}(hX^- 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 - 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](jZ)}(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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(hJpages are linked to per-memcg LRU exclusively, and there is no global LRU.h]h)}(hjh]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&]uh1jYhjubjZ)}(h;optionally, memory+swap usage can be accounted and limited.h]h)}(hj5h]h;optionally, memory+swap usage can be accounted and limited.}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hj3ubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(hhierarchical accountingh]h)}(hjLh]hhierarchical accounting}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjJubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(h;moving (recharging) account at moving a task is selectable.h]h)}(hjch]h;moving (recharging) account at moving a task is selectable.}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjaubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(husage threshold notifierh]h)}(hjzh]husage threshold notifier}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK3hjxubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(hmemory pressure notifierh]h)}(hjh]hmemory pressure notifier}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(h(oom-killer disable knob and oom-notifierh]h)}(hjh]h(oom-killer disable knob and oom-notifier}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(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&]uh1hhhhK6hjubah}(h]h ]h"]h$]h&]uh1jYhjubeh}(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&]refdocjH refdomainjreftyperef refexplicitrefwarn reftarget!cgroup-v1-memory-kernel-extensionuh1hhhhK8hjubh)}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjubeh}(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 ubah}(h]h ]h"]h$]h&]uh1jYhj; hhhhhNubjZ)}(hmlock(2) controllerh]h)}(hjW h]hmlock(2) controller}(hjY hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjU ubah}(h]h ]h"]h$]h&]uh1jYhj; hhhhhNubjZ)}(h.Kernel user memory accounting and slab controlh]h)}(hjn h]h.Kernel user memory accounting and slab control}(hjp hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjl ubah}(h]h ]h"]h$]h&]uh1jYhj; hhhhhNubjZ)}(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&]uh1jYhj; hhhhhNubeh}(h]h ]h"]h$]h&]jarabicjhjjuh1jThj 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 hhubjU)}(hhh](jZ)}(hAccounting happens per cgrouph]h)}(hj0 h]hAccounting happens per cgroup}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj. ubah}(h]h ]h"]h$]h&]uh1jYhj+ hhhhhNubjZ)}(h5Each mm_struct knows about which cgroup it belongs toh]h)}(hjG h]h5Each mm_struct knows about which cgroup it belongs to}(hjI hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjE ubah}(h]h ]h"]h$]h&]uh1jYhj+ hhhhhNubjZ)}(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}(hj` hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ ubah}(h]h ]h"]h$]h&]uh1jYhj+ hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1jThj 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.}(hjz 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.}(hj5 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.}(hjC hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ hhubj)}(h>- memory.memsw.usage_in_bytes. - memory.memsw.limit_in_bytes. h]j)}(hhh](jZ)}(hmemory.memsw.usage_in_bytes.h]h)}(hjZ h]hmemory.memsw.usage_in_bytes.}(hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjX ubah}(h]h ]h"]h$]h&]uh1jYhjU ubjZ)}(hmemory.memsw.limit_in_bytes. h]h)}(hmemory.memsw.limit_in_bytes.h]hmemory.memsw.limit_in_bytes.}(hjs hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjo ubah}(h]h ]h"]h$]h&]uh1jYhjU ubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhjQ 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&]uh1hhhhKhj$ 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 hhhhhMubh)}(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$ hhhhhMubh)}(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&]refdocjH refdomainj, reftyperef refexplicitrefwarnjcgroup-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.}(hjH 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.}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM(hjV ubah}(h]h ]h"]h$]h&]uh1hhj hhhhhNubh)}(h=When panic_on_oom is set to "2", the whole system will panic.h]h)}(hjp h]hAWhen panic_on_oom is set to “2”, the whole system will panic.}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjn 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&]refdocjH refdomainj reftyperef refexplicitrefwarnjcgroup-v1-memory-oom-controluh1hhhhM.hj ubh section)}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM.hj 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 hhhhhM2ubh)}(hLock order is as follows::h]hLock order is as follows:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hj hhubj )}(hdfolio_lock mm->page_table_lock or split pte_lock mapping->i_pages lock lruvec->lru_lock.h]hdfolio_lock mm->page_table_lock or split pte_lock mapping->i_pages lock lruvec->lru_lock.}hj sbah}(h]h ]h"]h$]h&]j j uh1j hhhM6hj 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&]jE!cgroup-v1-memory-kernel-extensionuh1j hM?hj hhhhubeh}(h]lockingah ]h"] 2.6 lockingah$]h&]uh1hhj hhhhhM2ubh)}(hhh](h)}(h2.7 Kernel Memory Extensionh]h2.7 Kernel Memory Extension}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMBubh)}(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&]uh1hhhhMDhjhhubh)}(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.}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMIhjhhubh)}(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&]uh1hhhhMMhjhhubh)}(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.}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhjhhubeh}(h](kernel-memory-extensionjeh ]h"](2.7 kernel memory extension!cgroup-v1-memory-kernel-extensioneh$]h&]uh1hhj hhhhhMBexpect_referenced_by_name}j^j sexpect_referenced_by_id}jj subh)}(hhh](h)}(h/2.7.1 Current Kernel Memory resources accountedh]h/2.7.1 Current Kernel Memory resources accounted}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjehhhhhMVubhdefinition_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&]uh1jhhhM[hj}ubh 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&]uh1hhhhMYhjubah}(h]h ]h"]h$]h&]uh1jhj}ubeh}(h]h ]h"]h$]h&]uh1j{hhhM[hjxubj|)}(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&]uh1jhhhMchjubj)}(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&]uh1hhhhM^hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j{hhhMchjxhhubj|)}(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&]uh1jhhhMhhjubj)}(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&]uh1hhhhMfhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j{hhhMhhjxhhubj|)}(hCtcp memory pressure: sockets memory pressure for the tcp protocol. h](j)}(htcp memory pressure:h]htcp memory pressure:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMkhjubj)}(hhh]h)}(h-sockets memory pressure for the tcp protocol.h]h-sockets memory pressure for the tcp protocol.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMkhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j{hhhMkhjxhhubeh}(h]h ]h"]h$]h&]uh1jvhjehhhhhNubeh}(h])current-kernel-memory-resources-accountedah ]h"]/2.7.1 current kernel memory resources accountedah$]h&]uh1hhj hhhhhMVubh)}(hhh](h)}(h2.7.2 Common use casesh]h2.7.2 Common use cases}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjKhhhhhMnubh)}(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:}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphjKhhubjw)}(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:}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMwhjmubj)}(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&]uh1hhhhMvhjubah}(h]h ]h"]h$]h&]uh1jhjmubeh}(h]h ]h"]h$]h&]uh1j{hhhMwhjjubj|)}(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&]uh1hhhhMzhjubhwarning)}(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&]uh1j{hhhMhjjhhubj|)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j{hhhMhjjhhubeh}(h]h ]h"]h$]h&]uh1jvhjKhhhhhNubeh}(h]common-use-casesah ]h"]2.7.2 common use casesah$]h&]uh1hhj hhhhhMnubeh}(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:}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj*hhubjU)}(hhh](jZ)}(h.Enable CONFIG_CGROUPS and CONFIG_MEMCG optionsh]h)}(hjNh]h.Enable CONFIG_CGROUPS and CONFIG_MEMCG options}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubah}(h]h ]h"]h$]h&]uh1jYhjIhhhhhNubjZ)}(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 }(hjghhhNhNubh)}(h3:ref:`Why are cgroups needed? `h]j)}(hjqh]hWhy are cgroups needed?}(hjshhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjoubah}(h]h ]h"]h$]h&]refdocjH refdomainj}reftyperef refexplicitrefwarnjcgroups-why-neededuh1hhhhMhjgubh! for the background information):}(hjghhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubj )}(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 hhhMhjcubeh}(h]h ]h"]h$]h&]uh1jYhjIhhhhhNubjZ)}(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&]uh1jYhjIhhhhhNubjZ)}(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&]uh1jYhjIhhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1jThj*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.)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhNubh)}(h?We can write "-1" to reset the ``*.limit_in_bytes(unlimited)``.h]h)}(hj5h](h#We can write “-1” to reset the }(hj7hhhNhNubhliteral)}(h``*.limit_in_bytes(unlimited)``h]h*.limit_in_bytes(unlimited)}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj7ubh.}(hj7hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj3ubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhNubh)}(h1We cannot set limits on the root cgroup any more.h]h)}(hj`h]h1We cannot set limits on the root cgroup any more.}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj^ubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhNubh)}(hWe can check the usage::h]hWe can check the usage:}(hjuhhhNhNubah}(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).}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj%hhubh)}(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&]refdocjH refdomainjreftyperef refexplicitrefwarnjcgroup-v1-memory-oom-controluh1hhhhMhjubh1 (below) and seeing what happens will be helpful.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj%hhubj )}(h).. _cgroup-v1-memory-test-task-migration:h]h}(h]h ]h"]h$]h&]jE$cgroup-v1-memory-test-task-migrationuh1j hMhj%hhhhubeh}(h](troubleshootingj$eh ]h"](4.1 troubleshooting"cgroup-v1-memory-test-troubleshooteh$]h&]uh1hhjhhhhhMja}jjsjc}j$jsubh)}(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)}(hjh]h'8. “Move charges at task migration”}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocjH refdomainjreftyperef refexplicitrefwarnjcgroup-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&]uh1hhjhhhhhMja}j%jsjc}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 }(hj;hhhNhNubh)}(h8:ref:`sections 4.1 `h]j)}(hjEh]h sections 4.1}(hjGhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjCubah}(h]h ]h"]h$]h&]refdocjH refdomainjQreftyperef refexplicitrefwarnj"cgroup-v1-memory-test-troubleshootuh1hhhhMhj;ubh and }(hj;hhhNhNubh)}(h1:ref:`4.2 `h]j)}(hjih]h4.2}(hjkhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjgubah}(h]h ]h"]h$]h&]refdocjH refdomainjureftyperef refexplicitrefwarnj$cgroup-v1-memory-test-task-migrationuh1hhhhMhj;ubh, 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.)}(hj;hhhNhNubeh}(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&]uh1hhhhMhj*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&]uh1hhjhhhhhM ubh)}(hhh](h)}(h5.1 force_emptyh]h5.1 force_empty}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM ubj)}(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&]uh1hhhhM hjubj )}(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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhhhM hjhhubeh}(h] force-emptyah ]h"]5.1 force_emptyah$]h&]uh1hhjhhhhhM ubh)}(hhh](h)}(h 5.2 stat fileh]h 5.2 stat file}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hhhhhMubh)}(h/memory.stat file includes following statistics:h]h/memory.stat file includes following statistics:}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)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](jZ)}(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}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjOubj()}(hhh]j-)}(hhh](j2)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j1hjdubj2)}(hhh]h}(h]h ]h"]h$]h&]colwidthK?uh1j1hjdubjH)}(hhh](jM)}(hhh](jR)}(hhh]h)}(hcacheh]hcache}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hjubah}(h]h ]h"]h$]h&]uh1jQhj~ubjR)}(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&]uh1jQhj~ubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hrssh]hrss}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hrss_hugeh]hrss_huge}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(hhh]h)}(h.# of bytes of anonymous transparent hugepages.h]h.# of bytes of anonymous transparent hugepages.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h mapped_fileh]h mapped_file}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hj&ubah}(h]h ]h"]h$]h&]uh1jQhj#ubjR)}(hhh]h)}(h0# of bytes of mapped file (includes tmpfs/shmem)h]h0# of bytes of mapped file (includes tmpfs/shmem)}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hj=ubah}(h]h ]h"]h$]h&]uh1jQhj#ubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hpgpginh]hpgpgin}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hj]ubah}(h]h ]h"]h$]h&]uh1jQhjZubjR)}(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.}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hjtubah}(h]h ]h"]h$]h&]uh1jQhjZubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hpgpgouth]hpgpgout}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hswaph]hswap}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(hhh]h)}(h# of bytes of swap usageh]h# of bytes of swap usage}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h swapcachedh]h swapcached}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(hhh]h)}(h## of bytes of swap cached in memoryh]h## of bytes of swap cached in memory}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(hdirtyh]hdirty}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hj9ubah}(h]h ]h"]h$]h&]uh1jQhj6ubjR)}(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.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM.hjPubah}(h]h ]h"]h$]h&]uh1jQhj6ubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h writebackh]h writeback}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hjpubah}(h]h ]h"]h$]h&]uh1jQhjmubjR)}(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&]uh1hhhhM/hjubah}(h]h ]h"]h$]h&]uh1jQhjmubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h inactive_anonh]h inactive_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM1hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1hhhhM1hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h active_anonh]h active_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h inactive_fileh]h inactive_file}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1hhhhM5hj,ubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h active_fileh]h active_file}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hjLubah}(h]h ]h"]h$]h&]uh1jQhjIubjR)}(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.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hjcubah}(h]h ]h"]h$]h&]uh1jQhjIubeh}(h]h ]h"]h$]h&]uh1jLhj{ubjM)}(hhh](jR)}(hhh]h)}(h unevictableh]h unevictable}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1hhhhM8hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhj{ubeh}(h]h ]h"]h$]h&]uh1jGhjdubeh}(h]h ]h"]h$]h&]colsKuh1j,hjaubah}(h]h ]h"]h$]h&]uh1j'hjOubeh}(h]h ]h"]h$]h&]uh1jYhjLubjZ)}(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&]uh1hhhhM;hjubj()}(hhh]j-)}(hhh](j2)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j1hjubj2)}(hhh]h}(h]h ]h"]h$]h&]colwidthK3uh1j1hjubjH)}(hhh](jM)}(hhh](jR)}(hhh]h)}(hhierarchical_memory_limith]hhierarchical_memory_limit}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM>hjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hhh](jR)}(hhh]h)}(hhierarchical_memsw_limith]hhierarchical_memsw_limit}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhj9ubah}(h]h ]h"]h$]h&]uh1jQhj6ubjR)}(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.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjPubah}(h]h ]h"]h$]h&]uh1jQhj6ubeh}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hhh](jR)}(hhh]h)}(htotal_h]htotal_}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMDhjpubah}(h]h ]h"]h$]h&]uh1jQhjmubjR)}(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&]uh1hhhhMDhjubah}(h]h ]h"]h$]h&]uh1jQhjmubeh}(h]h ]h"]h$]h&]uh1jLhjubeh}(h]h ]h"]h$]h&]uh1jGhjubeh}(h]h ]h"]h$]h&]colsKuh1j,hjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jYhjLubjZ)}(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&]uh1hhhhMJhjubj()}(hhh]j-)}(hhh](j2)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1j1hjubj2)}(hhh]h}(h]h ]h"]h$]h&]colwidthK(uh1j1hjubjH)}(hhh](jM)}(hhh](jR)}(hhh]h)}(hrecent_rotated_anonh]hrecent_rotated_anon}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMMhjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMMhjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hhh](jR)}(hhh]h)}(hrecent_rotated_fileh]hrecent_rotated_file}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj&ubah}(h]h ]h"]h$]h&]uh1jQhj#ubjR)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj=ubah}(h]h ]h"]h$]h&]uh1jQhj#ubeh}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hhh](jR)}(hhh]h)}(hrecent_scanned_anonh]hrecent_scanned_anon}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMOhj]ubah}(h]h ]h"]h$]h&]uh1jQhjZubjR)}(hhh]h)}(h(VM internal parameter. (see mm/vmscan.c)h]h(VM internal parameter. (see mm/vmscan.c)}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMOhjtubah}(h]h ]h"]h$]h&]uh1jQhjZubeh}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hhh](jR)}(hhh]h)}(hrecent_scanned_fileh]hrecent_scanned_file}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjubah}(h]h ]h"]h$]h&]uh1jQhjubjR)}(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&]uh1hhhhMPhjubah}(h]h ]h"]h$]h&]uh1jQhjubeh}(h]h ]h"]h$]h&]uh1jLhjubeh}(h]h ]h"]h$]h&]uh1jGhjubeh}(h]h ]h"]h$]h&]colsKuh1j,hjubah}(h]h ]h"]h$]h&]uh1j'hjubeh}(h]h ]h"]h$]h&]uh1jYhjLubeh}(h]h ]h"]h$]h&]j*uh1jhhhMhjHubah}(h]h ]h"]h$]h&]uh1jhhhMhj)hhubj)}(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&]uh1hhhhMThjubah}(h]h ]h"]h$]h&]uh1jhj)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.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMYhjubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM]hjubh)}(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.}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hjubh)}(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.)}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMchjubeh}(h]h ]h"]h$]h&]uh1hhj)hhhhhNubeh}(h] stat-fileah ]h"] 5.2 stat fileah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h5.3 swappinessh]h5.3 swappiness}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhjPhhhhhMhubh)}(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.}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMjhjPhhubh)}(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.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMmhjPhhubeh}(h] swappinessah ]h"]5.3 swappinessah$]h&]uh1hhjhhhhhMhubh)}(hhh](h)}(h 5.4 failcnth]h 5.4 failcnt}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMsubh)}(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&]uh1hhhhMuhjhhubh)}(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&]uh1hhhhMzhjhhubj )}(h# echo 0 > .../memory.failcnth]h# echo 0 > .../memory.failcnt}hjsbah}(h]h ]h"]h$]h&]j j uh1j hhhM|hjhhubeh}(h]failcntah ]h"] 5.4 failcntah$]h&]uh1hhjhhhhhMsubh)}(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:}(hjhhhNhNubah}(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.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h] numa-statah ]h"] 5.6 numa_statah$]h&]uh1hhjhhhhhMubeh}(h]misc-interfacesah ]h"]5. misc. interfacesah$]h&]uh1hhhhhhhhM ubh)}(hhh](h)}(h6. Hierarchy supporth]h6. Hierarchy support}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjVhhhhhMubh)}(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:}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjVhhubj )}(h\ root / | \ / | \ a b c | \ | \ d eh]h\ root / | \ / | \ a b c | \ | \ d e}hjusbah}(h]h ]h"]h$]h&]j j uh1j hhhMhjVhhubh)}(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&]uh1hhhhMhjVhhubh)}(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&]uh1hhjVhhhhhMubeh}(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)}(hhWriting to memory.soft_limit_in_bytes has no effect and reading it will always return the maximum value.h]hhWriting to memory.soft_limit_in_bytes has no effect and reading it will always return the maximum value.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h3Use memory.low and memory.min in cgroup v2 instead.h]h3Use memory.low and memory.min in cgroup v2 instead.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(h".. _cgroup-v1-memory-move-charges:h]h}(h]h ]h"]h$]h&]jEcgroup-v1-memory-move-chargesuh1j hMhjhhhhubeh}(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!)}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj*hhubh)}(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.}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj*hhubeh}(h]()move-charges-at-task-migration-deprecatedj!eh ]h"](/8. move charges at task migration (deprecated!)cgroup-v1-memory-move-chargeseh$]h&]uh1hhhhhhhhMja}j]jsjc}j!jsubh)}(hhh](h)}(h9. Memory thresholdsh]h9. Memory thresholds}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhjbhhhhhMubh)}(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.}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjbhhubh)}(h-To register a threshold, an application must:h]h-To register a threshold, an application must:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjbhhubj)}(hhh](jZ)}(h#create an eventfd using eventfd(2);h]h)}(hjh]h#create an eventfd using eventfd(2);}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjhhhhhNubjZ)}(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&]uh1jYhjhhhhhNubjZ)}(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&]uh1jYhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjbhhubh)}(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&]uh1hhhhMhjbhhubh)}(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&]uh1hhhhMhjbhhubj )}(h!.. _cgroup-v1-memory-oom-control:h]h}(h]h ]h"]h$]h&]jEcgroup-v1-memory-oom-controluh1j hMhjbhhhhubeh}(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&]uh1hhj hhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hCmemory.oom_control file is for OOM notification and other controls.h]hCmemory.oom_control file is for OOM notification and other controls.}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(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.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h,To register a notifier, an application must:h]h,To register a notifier, an application must:}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(h- create an eventfd using eventfd(2) - open memory.oom_control file - write string like " " to cgroup.event_control h]j)}(hhh](jZ)}(h"create an eventfd using eventfd(2)h]h)}(hj_h]h"create an eventfd using eventfd(2)}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj]ubah}(h]h ]h"]h$]h&]uh1jYhjZubjZ)}(hopen memory.oom_control fileh]h)}(hjvh]hopen memory.oom_control file}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjtubah}(h]h ]h"]h$]h&]uh1jYhjZubjZ)}(hRwrite string like " " to cgroup.event_control h]h)}(hQwrite string like " " to cgroup.event_controlh]hUwrite string like “ ” to cgroup.event_control}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjZubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjVubah}(h]h ]h"]h$]h&]uh1jhhhMhj hhubh)}(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&]uh1hhhhMhj hhubh)}(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&]uh1hhhhMhj hhubj)}(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&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhj hhubh)}(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&]uh1hhhhMhj hhubh)}(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&]uh1hhhhMhj hhubj)}(h!* enlarge limit or reduce usage. h]j)}(hhh]jZ)}(henlarge limit or reduce usage. h]h)}(henlarge limit or reduce usage.h]henlarge limit or reduce usage.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjubah}(h]h ]h"]h$]h&]jjuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhj hhubh)}(hTo reduce usage,h]hTo reduce usage,}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(hl* kill some tasks. * move some tasks to other group with account migration. * remove some files (on tmpfs?) h]j)}(hhh](jZ)}(hkill some tasks.h]h)}(hjAh]hkill some tasks.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj?ubah}(h]h ]h"]h$]h&]uh1jYhj<ubjZ)}(h6move some tasks to other group with account migration.h]h)}(hjXh]h6move some tasks to other group with account migration.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjVubah}(h]h ]h"]h$]h&]uh1jYhj<ubjZ)}(hremove some files (on tmpfs?) h]h)}(hremove some files (on tmpfs?)h]hremove some files (on tmpfs?)}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjmubah}(h]h ]h"]h$]h&]uh1jYhj<ubeh}(h]h ]h"]h$]h&]jjuh1jhhhM hj8ubah}(h]h ]h"]h$]h&]uh1jhhhM hj hhubh)}(h$Then, stopped tasks will work again.h]h$Then, stopped tasks will work again.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h+At reading, current status of OOM is shown.h]h+At reading, current status of OOM is shown.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(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](jZ)}(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&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(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&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(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&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jYhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhj hhubeh}(h](oom-control-deprecatedjeh ]h"](10. oom control (deprecated)cgroup-v1-memory-oom-controleh$]h&]uh1hhhhhhhhMja}jjsjc}jjsubh)}(hhh](h)}(h 11. Memory Pressure (DEPRECATED)h]h 11. Memory Pressure (DEPRECATED)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hTHIS IS DEPRECATED!h]hTHIS IS DEPRECATED!}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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:}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(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&]uh1hhhhM$hjhhubh)}(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.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM*hjhhubh)}(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.jh]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.}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM0hjhhubh)}(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.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjhhubh)}(hKThere are three optional modes that specify different propagation behavior:h]hKThere are three optional modes that specify different propagation behavior:}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hjhhubj)}(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](jZ)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMEhjubah}(h]h ]h"]h$]h&]uh1jYhjubjZ)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMJhjubah}(h]h ]h"]h$]h&]uh1jYhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhMAhjubah}(h]h ]h"]h$]h&]uh1jhhhMAhjhhubh)}(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.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMRhjhhubh)}(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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMXhjhhubj)}(hhh](jZ)}(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&]uh1hhhhM[hj ubah}(h]h ]h"]h$]h&]uh1jYhjhhhhhNubjZ)}(hopen memory.pressure_level;h]h)}(hj h]hopen memory.pressure_level;}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM\hj ubah}(h]h ]h"]h$]h&]uh1jYhjhhhhhNubjZ)}(hcwrite string as " " to cgroup.event_control. h]h)}(hbwrite string as " " to cgroup.event_control.h]hfwrite string as “ ” to cgroup.event_control.}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM]hj. ubah}(h]h ]h"]h$]h&]uh1jYhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhM[hjhhubh)}(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.}(hjL hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM`hjhhubh)}(hTest:h]hTest:}(hjZ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhjhhubj)}(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:}(hjl hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMfhjh 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}hjz sbah}(h]h ]h"]h$]h&]j j uh1j hhhMjhjh 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&]uh1hhhhMshjh ubeh}(h]h ]h"]h$]h&]uh1jhhhMfhjhhubeh}(h]memory-pressure-deprecatedah ]h"] 11. memory pressure (deprecated)ah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h12. TODOh]h12. TODO}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMwubjU)}(hhh](jZ)}(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&]uh1hhhhMyhj ubah}(h]h ]h"]h$]h&]uh1jYhj hhhhhNubjZ)}(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&]uh1hhhhMzhj ubah}(h]h ]h"]h$]h&]uh1jYhj hhhhhNubjZ)}(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&]uh1hhhhM{hj ubah}(h]h ]h"]h$]h&]uh1jYhj hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjuh1jThj hhhhhMyubeh}(h]todoah ]h"]12. todoah$]h&]uh1hhhhhhhhMwubh)}(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}(hj6!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3!hhhhhMubhfootnote)}(hFSingh, Balbir. RFC: Memory Controller, http://lwn.net/Articles/206697/h](hlabel)}(h1h]h1}(hjL!hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!hjF!ubh)}(hjH!h](h'Singh, Balbir. RFC: Memory Controller, }(hjZ!hhhNhNubh reference)}(hhttp://lwn.net/Articles/206697/h]hhttp://lwn.net/Articles/206697/}(hjc!hhhNhNubah}(h]h ]h"]h$]h&]refurije!uh1ja!hjZ!ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjF!ubeh}(h]j ah ]h"]1ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjE!)}(hOSingh, Balbir. Memory Controller (RSS Control), http://lwn.net/Articles/222762/h](jK!)}(h2h]h2}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!hj!ubh)}(hOSingh, Balbir. Memory Controller (RSS Control), http://lwn.net/Articles/222762/h](h0Singh, Balbir. Memory Controller (RSS Control), }(hj!hhhNhNubjb!)}(hhttp://lwn.net/Articles/222762/h]hhttp://lwn.net/Articles/222762/}(hj!hhhNhNubah}(h]h ]h"]h$]h&]refurij!uh1ja!hj!ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubeh}(h]j ah ]h"]2ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjE!)}(hpEmelianov, Pavel. Resource controllers based on process cgroups https://lore.kernel.org/r/45ED7DEC.7010403@sw.ruh](jK!)}(h3h]h3}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!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!hhhNhNubjb!)}(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!uh1ja!hj!ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubeh}(h]j ah ]h"]3ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjE!)}(hmEmelianov, Pavel. RSS controller based on process cgroups (v2) https://lore.kernel.org/r/461A3010.90403@sw.ruh](jK!)}(h4h]h4}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!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!hhhNhNubjb!)}(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"uh1ja!hj!ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!ubeh}(h]j ah ]h"]4ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjE!)}(huEmelianov, Pavel. RSS controller based on process cgroups (v3) https://lore.kernel.org/r/465D9739.8070209@openvz.org h](jK!)}(h5h]h5}(hj%"hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!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) }(hj3"hhhNhNubjb!)}(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="uh1ja!hj3"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj!"ubeh}(h]j ah ]h"]5ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjU)}(hhh](jZ)}(hAMenage, Paul. Control Groups v10, http://lwn.net/Articles/236032/h]h)}(hj\"h](h"Menage, Paul. Control Groups v10, }(hj^"hhhNhNubjb!)}(hhttp://lwn.net/Articles/236032/h]hhttp://lwn.net/Articles/236032/}(hje"hhhNhNubah}(h]h ]h"]h$]h&]refurijg"uh1ja!hj^"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjZ"ubah}(h]h ]h"]h$]h&]uh1jYhjW"hhhhhNubjZ)}(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"hhhNhNubjb!)}(hhttp://lwn.net/Articles/235534/h]hhttp://lwn.net/Articles/235534/}(hj"hhhNhNubah}(h]h ]h"]h$]h&]refurij"uh1ja!hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jYhjW"hhhhhNubjZ)}(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"hhhNhNubjb!)}(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"uh1ja!hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jYhjW"hhhhhNubjZ)}(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"hhhNhNubjb!)}(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"uh1ja!hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jYhjW"hhhhhNubjZ)}(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"hhhNhNubjb!)}(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#uh1ja!hj"ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jYhjW"hhhhhNubeh}(h]h ]h"]h$]h&]jj jhjjstartKuh1jThj3!hhhhhMubjE!)}(hSingh, Balbir. Memory controller introduction (v6), https://lore.kernel.org/r/20070817084228.26003.12568.sendpatchset@balbir-laptoph](jK!)}(h11h]h11}(hj'#hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!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), }(hj5#hhhNhNubjb!)}(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?#uh1ja!hj5#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhj##ubeh}(h]j ah ]h"]11ah$]h&]j ajGjHuh1jD!hhhMhj3!hhjIKubjE!)}(hTCorbet, Jonathan, Controlling memory use in cgroups, http://lwn.net/Articles/243795/h](jK!)}(h12h]h12}(hj]#hhhNhNubah}(h]h ]h"]h$]h&]uh1jJ!hjY#ubh)}(hTCorbet, Jonathan, Controlling memory use in cgroups, http://lwn.net/Articles/243795/h](h5Corbet, Jonathan, Controlling memory use in cgroups, }(hjk#hhhNhNubjb!)}(hhttp://lwn.net/Articles/243795/h]hhttp://lwn.net/Articles/243795/}(hjs#hhhNhNubah}(h]h ]h"]h$]h&]refuriju#uh1ja!hjk#ubeh}(h]h ]h"]h$]h&]uh1hhhhMhjY#ubeh}(h]jFah ]h"]12ah$]h&]j@ajGjHuh1jD!hhhMhj3!hhjIKubeh}(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_backlinksjQfootnote_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]j6a1]j a2]j a3]j a4]j a5]j a11]j aurefids}(j]j aj$]jaj]jaj!]jaj]jaunameids}(j#j#jl ji j j j'j$j j j j j j j! j j j j j j j j j j j j^jj]jZjHjEjjjjjjjj$jjj%jj$j!jjjSjPj&j#jMjJjjjjjjjKjHjjjjj'j$j]j!j\jYj jjjj j j j j !j!j0!j-!j#j#j|!j j!j j!j j"j jT"j jV#j j#jFu nametypes}(j#jl j j'j j j j! j j j j j j^j]jHjjjjjj%j$jjSj&jMjjjjKjjj'j]j\j jj j j !j0!j#j|!j!j!j"jT"jV#j#uh}(j#hji jj@j6j jo j j j j j j j j j j j j j$j j j j j j j j j j j$ j j j j j j j j jjjZjjEjejjKjj*jjj$j%jj%jjj!jjj*jPjj#jjJj)jjPjjjjjHjjjVjjj$jj!j*jYj*jjbjj j j j jj!j j-!j !j#j3!j jF!j j!j j!j j!j j!"j j##jFjY#j j u footnote_refs}(j$]j6aj$]j aj$]j aj$]j aj $]j aj $]j aj $]j au citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes](jF!j!j!j!j!"j##jY#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)}(hjB$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj?$ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehʌlineKuh1j=$hj3!hhhhhMubatransform_messages](j>$)}(hhh]h)}(hhh]hGHyperlink target "cgroup-v1-memory-kernel-extension" is not referenced.}hj`$sbah}(h]h ]h"]h$]h&]uh1hhj]$ubah}(h]h ]h"]h$]h&]levelKtypejX$sourcehʌlineM?uh1j=$ubj>$)}(hhh]h)}(hhh]hHHyperlink target "cgroup-v1-memory-test-troubleshoot" is not referenced.}hjz$sbah}(h]h ]h"]h$]h&]uh1hhjw$ubah}(h]h ]h"]h$]h&]levelKtypejX$sourcehʌlineMuh1j=$ubj>$)}(hhh]h)}(hhh]hJHyperlink target "cgroup-v1-memory-test-task-migration" is not referenced.}hj$sbah}(h]h ]h"]h$]h&]uh1hhj$ubah}(h]h ]h"]h$]h&]levelKtypejX$sourcehʌlineMuh1j=$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&]levelKtypejX$sourcehʌlineMuh1j=$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&]levelKtypejX$sourcehʌlineMuh1j=$ube transformerN include_log] decorationNhhub.