€•8Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ1/translations/zh_CN/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/zh_TW/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/it_IT/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ja_JP/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ko_KR/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/pt_BR/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/sp_SP/admin-guide/cgroup-v1/cgroups”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒControl Groups”h]”hŒControl Groups”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒK/var/lib/git/docbuild/linux/Documentation/admin-guide/cgroup-v1/cgroups.rst”h´KubhŒ paragraph”“”)�”}”(hŒcWritten by Paul Menage based on Documentation/admin-guide/cgroup-v1/cpusets.rst”h]”(hŒWritten by Paul Menage <”…”�”}”(hhÍh²hh³Nh´NubhŒ reference”“”)�”}”(hŒmenage@google.com”h]”hŒmenage@google.com”…”�”}”(hh×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:menage@google.com”uh1hÕhhÍubhŒ:> based on Documentation/admin-guide/cgroup-v1/cpusets.rst”…”�”}”(hhÍh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒ/Original copyright statements from cpusets.txt:”h]”hŒ/Original copyright statements from cpusets.txt:”…”�”}”(hhñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒ$Portions Copyright (C) 2004 BULL SA.”h]”hŒ$Portions Copyright (C) 2004 BULL SA.”…”�”}”(hhÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhÌ)�”}”(hŒ7Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.”h]”hŒ7Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhÌ)�”}”(hŒ%Modified by Paul Jackson ”h]”(hŒModified by Paul Jackson <”…”�”}”(hjh²hh³Nh´NubhÖ)�”}”(hŒ pj@sgi.com”h]”hŒ pj@sgi.com”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:pj@sgi.com”uh1hÕhjubhŒ>”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒ-Modified by Christoph Lameter ”h]”(hŒModified by Christoph Lameter <”…”�”}”(hj=h²hh³Nh´NubhÖ)�”}”(hŒ cl@gentwo.org”h]”hŒ cl@gentwo.org”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:cl@gentwo.org”uh1hÕhj=ubhŒ>”…”�”}”(hj=h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒcomment”“”)�”}”(hX¥CONTENTS: 1. Control Groups 1.1 What are cgroups ? 1.2 Why are cgroups needed ? 1.3 How are cgroups implemented ? 1.4 What does notify_on_release do ? 1.5 What does clone_children do ? 1.6 How do I use cgroups ? 2. Usage Examples and Syntax 2.1 Basic Usage 2.2 Attaching processes 2.3 Mounting hierarchies by name 3. Kernel API 3.1 Overview 3.2 Synchronization 3.3 Subsystem API 4. Extended attributes usage 5. Questions”h]”hX¥CONTENTS: 1. Control Groups 1.1 What are cgroups ? 1.2 Why are cgroups needed ? 1.3 How are cgroups implemented ? 1.4 What does notify_on_release do ? 1.5 What does clone_children do ? 1.6 How do I use cgroups ? 2. Usage Examples and Syntax 2.1 Basic Usage 2.2 Attaching processes 2.3 Mounting hierarchies by name 3. Kernel API 3.1 Overview 3.2 Synchronization 3.3 Subsystem API 4. Extended attributes usage 5. Questions”…”�”}”hjasbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j_hh·h²hh³hÊh´K%ubh¶)�”}”(hhh]”(h»)�”}”(hŒ1. Control Groups”h]”hŒ1. Control Groups”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjqh²hh³hÊh´K'ubh¶)�”}”(hhh]”(h»)�”}”(hŒ1.1 What are cgroups ?”h]”hŒ1.1 What are cgroups ?”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj‚h²hh³hÊh´K*ubhÌ)�”}”(hŒ¢Control Groups provide a mechanism for aggregating/partitioning sets of tasks, and all their future children, into hierarchical groups with specialized behaviour.”h]”hŒ¢Control Groups provide a mechanism for aggregating/partitioning sets of tasks, and all their future children, into hierarchical groups with specialized behaviour.”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K,hj‚h²hubhÌ)�”}”(hŒ Definitions:”h]”hŒ Definitions:”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K0hj‚h²hubhÌ)�”}”(hŒYA *cgroup* associates a set of tasks with a set of parameters for one or more subsystems.”h]”(hŒA ”…”�”}”(hj¯h²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ*cgroup*”h]”hŒcgroup”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j·hj¯ubhŒO associates a set of tasks with a set of parameters for one or more subsystems.”…”�”}”(hj¯h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K2hj‚h²hubhÌ)�”}”(hXUA *subsystem* is a module that makes use of the task grouping facilities provided by cgroups to treat groups of tasks in particular ways. A subsystem is typically a "resource controller" that schedules a resource or applies per-cgroup limits, but it may be anything that wants to act on a group of processes, e.g. a virtualization subsystem.”h]”(hŒA ”…”�”}”(hjÑh²hh³Nh´Nubj¸)�”}”(hŒ *subsystem*”h]”hŒ subsystem”…”�”}”(hjÙh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j·hjÑubhXL is a module that makes use of the task grouping facilities provided by cgroups to treat groups of tasks in particular ways. A subsystem is typically a “resource controllerâ€� that schedules a resource or applies per-cgroup limits, but it may be anything that wants to act on a group of processes, e.g. a virtualization subsystem.”…”�”}”(hjÑh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K5hj‚h²hubhÌ)�”}”(hXLA *hierarchy* is a set of cgroups arranged in a tree, such that every task in the system is in exactly one of the cgroups in the hierarchy, and a set of subsystems; each subsystem has system-specific state attached to each cgroup in the hierarchy. Each hierarchy has an instance of the cgroup virtual filesystem associated with it.”h]”(hŒA ”…”�”}”(hjñh²hh³Nh´Nubj¸)�”}”(hŒ *hierarchy*”h]”hŒ hierarchy”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j·hjñubhX? is a set of cgroups arranged in a tree, such that every task in the system is in exactly one of the cgroups in the hierarchy, and a set of subsystems; each subsystem has system-specific state attached to each cgroup in the hierarchy. Each hierarchy has an instance of the cgroup virtual filesystem associated with it.”…”�”}”(hjñh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KUser-level code may create and destroy cgroups by name in an instance of the cgroup virtual file system, specify and query to which cgroup a task is assigned, and list the task PIDs assigned to a cgroup. Those creations and assignments only affect the hierarchy associated with that instance of the cgroup file system.”h]”hX>User-level code may create and destroy cgroups by name in an instance of the cgroup virtual file system, specify and query to which cgroup a task is assigned, and list the task PIDs assigned to a cgroup. Those creations and assignments only affect the hierarchy associated with that instance of the cgroup file system.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KEhj‚h²hubhÌ)�”}”(hX°On their own, the only use for cgroups is for simple job tracking. The intention is that other subsystems hook into the generic cgroup support to provide new attributes for cgroups, such as accounting/limiting the resources which processes in a cgroup can access. For example, cpusets (see Documentation/admin-guide/cgroup-v1/cpusets.rst) allow you to associate a set of CPUs and a set of memory nodes with the tasks in each cgroup.”h]”hX°On their own, the only use for cgroups is for simple job tracking. The intention is that other subsystems hook into the generic cgroup support to provide new attributes for cgroups, such as accounting/limiting the resources which processes in a cgroup can access. For example, cpusets (see Documentation/admin-guide/cgroup-v1/cpusets.rst) allow you to associate a set of CPUs and a set of memory nodes with the tasks in each cgroup.”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KKhj‚h²hubhŒtarget”“”)�”}”(hŒ.. _cgroups-why-needed:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œcgroups-why-needed”uh1j;h´KShj‚h²hh³hÊubeh}”(h]”Œwhat-are-cgroups”ah ]”h"]”Œ1.1 what are cgroups ?”ah$]”h&]”uh1hµhjqh²hh³hÊh´K*ubh¶)�”}”(hhh]”(h»)�”}”(hŒ1.2 Why are cgroups needed ?”h]”hŒ1.2 Why are cgroups needed ?”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjQh²hh³hÊh´KVubhÌ)�”}”(hX{There are multiple efforts to provide process aggregations in the Linux kernel, mainly for resource-tracking purposes. Such efforts include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server namespaces. These all require the basic notion of a grouping/partitioning of processes, with newly forked processes ending up in the same group (cgroup) as their parent process.”h]”hX{There are multiple efforts to provide process aggregations in the Linux kernel, mainly for resource-tracking purposes. Such efforts include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server namespaces. These all require the basic notion of a grouping/partitioning of processes, with newly forked processes ending up in the same group (cgroup) as their parent process.”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KXhjQh²hubhÌ)�”}”(hXThe kernel cgroup patch provides the minimum essential kernel mechanisms required to efficiently implement such groups. It has minimal impact on the system fast paths, and provides hooks for specific subsystems such as cpusets to provide additional behaviour as desired.”h]”hXThe kernel cgroup patch provides the minimum essential kernel mechanisms required to efficiently implement such groups. It has minimal impact on the system fast paths, and provides hooks for specific subsystems such as cpusets to provide additional behaviour as desired.”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K_hjQh²hubhÌ)�”}”(hX�Multiple hierarchy support is provided to allow for situations where the division of tasks into cgroups is distinctly different for different subsystems - having parallel hierarchies allows each hierarchy to be a natural division of tasks, without having to handle complex combinations of tasks that would be present if several unrelated subsystems needed to be forced into the same tree of cgroups.”h]”hX�Multiple hierarchy support is provided to allow for situations where the division of tasks into cgroups is distinctly different for different subsystems - having parallel hierarchies allows each hierarchy to be a natural division of tasks, without having to handle complex combinations of tasks that would be present if several unrelated subsystems needed to be forced into the same tree of cgroups.”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KehjQh²hubhÌ)�”}”(hŒ¥At one extreme, each resource controller or subsystem could be in a separate hierarchy; at the other extreme, all subsystems would be attached to the same hierarchy.”h]”hŒ¥At one extreme, each resource controller or subsystem could be in a separate hierarchy; at the other extreme, all subsystems would be attached to the same hierarchy.”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KmhjQh²hubhÌ)�”}”(hXAs an example of a scenario (originally proposed by vatsa@in.ibm.com) that can benefit from multiple hierarchies, consider a large university server with various users - students, professors, system tasks etc. The resource planning for this server could be along the following lines::”h]”(hŒ4As an example of a scenario (originally proposed by ”…”�”}”(hjšh²hh³Nh´NubhÖ)�”}”(hŒvatsa@in.ibm.com”h]”hŒvatsa@in.ibm.com”…”�”}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:vatsa@in.ibm.com”uh1hÕhjšubhŒ×) that can benefit from multiple hierarchies, consider a large university server with various users - students, professors, system tasks etc. The resource planning for this server could be along the following lines:”…”�”}”(hjšh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KqhjQh²hubhŒ literal_block”“”)�”}”(hX CPU : "Top cpuset" / \ CPUSet1 CPUSet2 | | (Professors) (Students) In addition (system tasks) are attached to topcpuset (so that they can run anywhere) with a limit of 20% Memory : Professors (50%), Students (30%), system (20%) Disk : Professors (50%), Students (30%), system (20%) Network : WWW browsing (20%), Network File System (60%), others (20%) / \ Professors (15%) students (5%)”h]”hX CPU : "Top cpuset" / \ CPUSet1 CPUSet2 | | (Professors) (Students) In addition (system tasks) are attached to topcpuset (so that they can run anywhere) with a limit of 20% Memory : Professors (50%), Students (30%), system (20%) Disk : Professors (50%), Students (30%), system (20%) Network : WWW browsing (20%), Network File System (60%), others (20%) / \ Professors (15%) students (5%)”…”�”}”hj¾sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´KwhjQh²hubhÌ)�”}”(hŒhBrowsers like Firefox/Lynx go into the WWW network class, while (k)nfsd goes into the NFS network class.”h]”hŒhBrowsers like Firefox/Lynx go into the WWW network class, while (k)nfsd goes into the NFS network class.”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KˆhjQh²hubhÌ)�”}”(hŒuAt the same time Firefox/Lynx will share an appropriate CPU/Memory class depending on who launched it (prof/student).”h]”hŒuAt the same time Firefox/Lynx will share an appropriate CPU/Memory class depending on who launched it (prof/student).”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K‹hjQh²hubhÌ)�”}”(hXWith the ability to classify tasks differently for different resources (by putting those resource subsystems in different hierarchies), the admin can easily set up a script which receives exec notifications and depending on who is launching the browser he can::”h]”hXWith the ability to classify tasks differently for different resources (by putting those resource subsystems in different hierarchies), the admin can easily set up a script which receives exec notifications and depending on who is launching the browser he can:”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KŽhjQh²hubj½)�”}”(hŒ?# echo browser_pid > /sys/fs/cgroup///tasks”h]”hŒ?# echo browser_pid > /sys/fs/cgroup///tasks”…”�”}”hjösbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´K“hjQh²hubhÌ)�”}”(hŒçWith only a single hierarchy, he now would potentially have to create a separate cgroup for every browser launched and associate it with appropriate network and other resource class. This may lead to proliferation of such cgroups.”h]”hŒçWith only a single hierarchy, he now would potentially have to create a separate cgroup for every browser launched and associate it with appropriate network and other resource class. This may lead to proliferation of such cgroups.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K•hjQh²hubhÌ)�”}”(hŒóAlso let's say that the administrator would like to give enhanced network access temporarily to a student's browser (since it is night and the user wants to do online gaming :)) OR give one of the student's simulation apps enhanced CPU power.”h]”hŒùAlso let’s say that the administrator would like to give enhanced network access temporarily to a student’s browser (since it is night and the user wants to do online gaming :)) OR give one of the student’s simulation apps enhanced CPU power.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KšhjQh²hubhÌ)�”}”(hŒPWith ability to write PIDs directly to resource classes, it's just a matter of::”h]”hŒQWith ability to write PIDs directly to resource classes, it’s just a matter of:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KŸhjQh²hubj½)�”}”(hŒ~# echo pid > /sys/fs/cgroup/network//tasks (after some time) # echo pid > /sys/fs/cgroup/network//tasks”h]”hŒ~# echo pid > /sys/fs/cgroup/network//tasks (after some time) # echo pid > /sys/fs/cgroup/network//tasks”…”�”}”hj.sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´K¢hjQh²hubhÌ)�”}”(hŒ¤Without this ability, the administrator would have to split the cgroup into multiple separate ones and then associate the new cgroups with the new resource classes.”h]”hŒ¤Without this ability, the administrator would have to split the cgroup into multiple separate ones and then associate the new cgroups with the new resource classes.”…”�”}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¦hjQh²hubeh}”(h]”(Œwhy-are-cgroups-needed”jHeh ]”h"]”(Œ1.2 why are cgroups needed ?”Œcgroups-why-needed”eh$]”h&]”uh1hµhjqh²hh³hÊh´KVŒexpect_referenced_by_name”}”jPj=sŒexpect_referenced_by_id”}”jHj=subh¶)�”}”(hhh]”(h»)�”}”(hŒ!1.3 How are cgroups implemented ?”h]”hŒ!1.3 How are cgroups implemented ?”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjWh²hh³hÊh´K­ubhÌ)�”}”(hŒ-Control Groups extends the kernel as follows:”h]”hŒ-Control Groups extends the kernel as follows:”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¯hjWh²hubhŒ block_quote”“”)�”}”(hX¶- Each task in the system has a reference-counted pointer to a css_set. - A css_set contains a set of reference-counted pointers to cgroup_subsys_state objects, one for each cgroup subsystem registered in the system. There is no direct link from a task to the cgroup of which it's a member in each hierarchy, but this can be determined by following pointers through the cgroup_subsys_state objects. This is because accessing the subsystem state is something that's expected to happen frequently and in performance-critical code, whereas operations that require a task's actual cgroup assignments (in particular, moving between cgroups) are less common. A linked list runs through the cg_list field of each task_struct using the css_set, anchored at css_set->tasks. - A cgroup hierarchy filesystem can be mounted for browsing and manipulation from user space. - You can list all the tasks (by PID) attached to any cgroup. ”h]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒFEach task in the system has a reference-counted pointer to a css_set. ”h]”hÌ)�”}”(hŒEEach task in the system has a reference-counted pointer to a css_set.”h]”hŒEEach task in the system has a reference-counted pointer to a css_set.”…”�”}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K±hjƒubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj~ubj‚)�”}”(hX³A css_set contains a set of reference-counted pointers to cgroup_subsys_state objects, one for each cgroup subsystem registered in the system. There is no direct link from a task to the cgroup of which it's a member in each hierarchy, but this can be determined by following pointers through the cgroup_subsys_state objects. This is because accessing the subsystem state is something that's expected to happen frequently and in performance-critical code, whereas operations that require a task's actual cgroup assignments (in particular, moving between cgroups) are less common. A linked list runs through the cg_list field of each task_struct using the css_set, anchored at css_set->tasks. ”h]”hÌ)�”}”(hX²A css_set contains a set of reference-counted pointers to cgroup_subsys_state objects, one for each cgroup subsystem registered in the system. There is no direct link from a task to the cgroup of which it's a member in each hierarchy, but this can be determined by following pointers through the cgroup_subsys_state objects. This is because accessing the subsystem state is something that's expected to happen frequently and in performance-critical code, whereas operations that require a task's actual cgroup assignments (in particular, moving between cgroups) are less common. A linked list runs through the cg_list field of each task_struct using the css_set, anchored at css_set->tasks.”h]”hX¸A css_set contains a set of reference-counted pointers to cgroup_subsys_state objects, one for each cgroup subsystem registered in the system. There is no direct link from a task to the cgroup of which it’s a member in each hierarchy, but this can be determined by following pointers through the cgroup_subsys_state objects. This is because accessing the subsystem state is something that’s expected to happen frequently and in performance-critical code, whereas operations that require a task’s actual cgroup assignments (in particular, moving between cgroups) are less common. A linked list runs through the cg_list field of each task_struct using the css_set, anchored at css_set->tasks.”…”�”}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K´hj›ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj~ubj‚)�”}”(hŒ\A cgroup hierarchy filesystem can be mounted for browsing and manipulation from user space. ”h]”hÌ)�”}”(hŒ[A cgroup hierarchy filesystem can be mounted for browsing and manipulation from user space.”h]”hŒ[A cgroup hierarchy filesystem can be mounted for browsing and manipulation from user space.”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÁhj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj~ubj‚)�”}”(hŒ cpuset.cpus /bin/echo 1 > cpuset.mems /bin/echo $$ > tasks sh # The subshell 'sh' is now running in cgroup Charlie # The next line should display '/Charlie' cat /proc/self/cgroup”h]”hXpmount -t tmpfs cgroup_root /sys/fs/cgroup mkdir /sys/fs/cgroup/cpuset mount -t cgroup cpuset -ocpuset /sys/fs/cgroup/cpuset cd /sys/fs/cgroup/cpuset mkdir Charlie cd Charlie /bin/echo 2-3 > cpuset.cpus /bin/echo 1 > cpuset.mems /bin/echo $$ > tasks sh # The subshell 'sh' is now running in cgroup Charlie # The next line should display '/Charlie' cat /proc/self/cgroup”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MKhjÜh²hubeh}”(h]”Œhow-do-i-use-cgroups”ah ]”h"]”Œ1.6 how do i use cgroups ?”ah$]”h&]”uh1hµhjqh²hh³hÊh´M8ubeh}”(h]”Œid1”ah ]”h"]”Œ1. control groups”ah$]”h&]”uh1hµhh·h²hh³hÊh´K'ubh¶)�”}”(hhh]”(h»)�”}”(hŒ2. Usage Examples and Syntax”h]”hŒ2. Usage Examples and Syntax”…”�”}”(hj8h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj5h²hh³hÊh´MZubh¶)�”}”(hhh]”(h»)�”}”(hŒ2.1 Basic Usage”h]”hŒ2.1 Basic Usage”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjFh²hh³hÊh´M]ubhÌ)�”}”(hŒUCreating, modifying, using cgroups can be done through the cgroup virtual filesystem.”h]”hŒUCreating, modifying, using cgroups can be done through the cgroup virtual filesystem.”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M_hjFh²hubhÌ)�”}”(hŒATo mount a cgroup hierarchy with all available subsystems, type::”h]”hŒ@To mount a cgroup hierarchy with all available subsystems, type:”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MbhjFh²hubj½)�”}”(hŒ$# mount -t cgroup xxx /sys/fs/cgroup”h]”hŒ$# mount -t cgroup xxx /sys/fs/cgroup”…”�”}”hjssbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MdhjFh²hubhÌ)�”}”(hŒ‡The "xxx" is not interpreted by the cgroup code, but will appear in /proc/mounts so may be any useful identifying string that you like.”h]”hŒ‹The “xxxâ€� is not interpreted by the cgroup code, but will appear in /proc/mounts so may be any useful identifying string that you like.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MfhjFh²hubhÌ)�”}”(hŒØNote: Some subsystems do not work without some user input first. For instance, if cpusets are enabled the user will have to populate the cpus and mems files for each new cgroup created before that group can be used.”h]”hŒØNote: Some subsystems do not work without some user input first. For instance, if cpusets are enabled the user will have to populate the cpus and mems files for each new cgroup created before that group can be used.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MihjFh²hubhÌ)�”}”(hX&As explained in section `1.2 Why are cgroups needed?` you should create different hierarchies of cgroups for each single resource or group of resources you want to control. Therefore, you should mount a tmpfs on /sys/fs/cgroup and create directories for each cgroup resource or resource group::”h]”(hŒAs explained in section ”…”�”}”(hj�h²hh³Nh´NubhŒtitle_reference”“”)�”}”(hŒ`1.2 Why are cgroups needed?`”h]”hŒ1.2 Why are cgroups needed?”…”�”}”(hj§h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¥hj�ubhŒð you should create different hierarchies of cgroups for each single resource or group of resources you want to control. Therefore, you should mount a tmpfs on /sys/fs/cgroup and create directories for each cgroup resource or resource group:”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MmhjFh²hubj½)�”}”(hŒF# mount -t tmpfs cgroup_root /sys/fs/cgroup # mkdir /sys/fs/cgroup/rg1”h]”hŒF# mount -t tmpfs cgroup_root /sys/fs/cgroup # mkdir /sys/fs/cgroup/rg1”…”�”}”hj¿sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MshjFh²hubhÌ)�”}”(hŒNTo mount a cgroup hierarchy with just the cpuset and memory subsystems, type::”h]”hŒMTo mount a cgroup hierarchy with just the cpuset and memory subsystems, type:”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MvhjFh²hubj½)�”}”(hŒ;# mount -t cgroup -o cpuset,memory hier1 /sys/fs/cgroup/rg1”h]”hŒ;# mount -t cgroup -o cpuset,memory hier1 /sys/fs/cgroup/rg1”…”�”}”hjÛsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MyhjFh²hubhÌ)�”}”(hXXWhile remounting cgroups is currently supported, it is not recommend to use it. Remounting allows changing bound subsystems and release_agent. Rebinding is hardly useful as it only works when the hierarchy is empty and release_agent itself should be replaced with conventional fsnotify. The support for remounting will be removed in the future.”h]”hXXWhile remounting cgroups is currently supported, it is not recommend to use it. Remounting allows changing bound subsystems and release_agent. Rebinding is hardly useful as it only works when the hierarchy is empty and release_agent itself should be replaced with conventional fsnotify. The support for remounting will be removed in the future.”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M{hjFh²hubhÌ)�”}”(hŒ(To Specify a hierarchy's release_agent::”h]”hŒ)To Specify a hierarchy’s release_agent:”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‚hjFh²hubj½)�”}”(hŒa# mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \ xxx /sys/fs/cgroup/rg1”h]”hŒa# mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \ xxx /sys/fs/cgroup/rg1”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M„hjFh²hubhÌ)�”}”(hŒHNote that specifying 'release_agent' more than once will return failure.”h]”hŒLNote that specifying ‘release_agent’ more than once will return failure.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‡hjFh²hubhÌ)�”}”(hXNote that changing the set of subsystems is currently only supported when the hierarchy consists of a single (root) cgroup. Supporting the ability to arbitrarily bind/unbind subsystems from an existing cgroup hierarchy is intended to be implemented in the future.”h]”hXNote that changing the set of subsystems is currently only supported when the hierarchy consists of a single (root) cgroup. Supporting the ability to arbitrarily bind/unbind subsystems from an existing cgroup hierarchy is intended to be implemented in the future.”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‰hjFh²hubhÌ)�”}”(hŒ¸Then under /sys/fs/cgroup/rg1 you can find a tree that corresponds to the tree of the cgroups in the system. For instance, /sys/fs/cgroup/rg1 is the cgroup that holds the whole system.”h]”hŒ¸Then under /sys/fs/cgroup/rg1 you can find a tree that corresponds to the tree of the cgroups in the system. For instance, /sys/fs/cgroup/rg1 is the cgroup that holds the whole system.”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŽhjFh²hubhÌ)�”}”(hŒ2If you want to change the value of release_agent::”h]”hŒ1If you want to change the value of release_agent:”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M’hjFh²hubj½)�”}”(hŒC# echo "/sbin/new_release_agent" > /sys/fs/cgroup/rg1/release_agent”h]”hŒC# echo "/sbin/new_release_agent" > /sys/fs/cgroup/rg1/release_agent”…”�”}”hjKsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M”hjFh²hubhÌ)�”}”(hŒ#It can also be changed via remount.”h]”hŒ#It can also be changed via remount.”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M–hjFh²hubhÌ)�”}”(hŒ=If you want to create a new cgroup under /sys/fs/cgroup/rg1::”h]”hŒ tasks”h]”hŒ# /bin/echo $$ > tasks”…”�”}”hjÓsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M©hjFh²hubhÌ)�”}”(hŒQYou can also create cgroups inside your cgroup by using mkdir in this directory::”h]”hŒPYou can also create cgroups inside your cgroup by using mkdir in this directory:”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M«hjFh²hubj½)�”}”(hŒ# mkdir my_sub_cs”h]”hŒ# mkdir my_sub_cs”…”�”}”hjïsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M®hjFh²hubhÌ)�”}”(hŒ$To remove a cgroup, just use rmdir::”h]”hŒ#To remove a cgroup, just use rmdir:”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M°hjFh²hubj½)�”}”(hŒ# rmdir my_sub_cs”h]”hŒ# rmdir my_sub_cs”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M²hjFh²hubhÌ)�”}”(hŒ�This will fail if the cgroup is in use (has cgroups inside, or has processes attached, or is held alive by other subsystem-specific reference).”h]”hŒ�This will fail if the cgroup is in use (has cgroups inside, or has processes attached, or is held alive by other subsystem-specific reference).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M´hjFh²hubeh}”(h]”Œ basic-usage”ah ]”h"]”Œ2.1 basic usage”ah$]”h&]”uh1hµhj5h²hh³hÊh´M]ubh¶)�”}”(hhh]”(h»)�”}”(hŒ2.2 Attaching processes”h]”hŒ2.2 Attaching processes”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj/h²hh³hÊh´M¹ubj½)�”}”(hŒ# /bin/echo PID > tasks”h]”hŒ# /bin/echo PID > tasks”…”�”}”hj@sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M½hj/h²hubhÌ)�”}”(hŒ‘Note that it is PID, not PIDs. You can only attach ONE task at a time. If you have several tasks to attach, you have to do it one after another::”h]”hŒ�Note that it is PID, not PIDs. You can only attach ONE task at a time. If you have several tasks to attach, you have to do it one after another:”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¿hj/h²hubj½)�”}”(hŒV# /bin/echo PID1 > tasks # /bin/echo PID2 > tasks ... # /bin/echo PIDn > tasks”h]”hŒV# /bin/echo PID1 > tasks # /bin/echo PID2 > tasks ... # /bin/echo PIDn > tasks”…”�”}”hj\sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MÂhj/h²hubhÌ)�”}”(hŒ4You can attach the current shell task by echoing 0::”h]”hŒ3You can attach the current shell task by echoing 0:”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÇhj/h²hubj½)�”}”(hŒ# echo 0 > tasks”h]”hŒ# echo 0 > tasks”…”�”}”hjxsbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´MÉhj/h²hubhÌ)�”}”(hX6You can use the cgroup.procs file instead of the tasks file to move all threads in a threadgroup at once. Echoing the PID of any task in a threadgroup to cgroup.procs causes all tasks in that threadgroup to be attached to the cgroup. Writing 0 to cgroup.procs moves all tasks in the writing task's threadgroup.”h]”hX8You can use the cgroup.procs file instead of the tasks file to move all threads in a threadgroup at once. Echoing the PID of any task in a threadgroup to cgroup.procs causes all tasks in that threadgroup to be attached to the cgroup. Writing 0 to cgroup.procs moves all tasks in the writing task’s threadgroup.”…”�”}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MËhj/h²hubhÌ)�”}”(hŒìNote: Since every task is always a member of exactly one cgroup in each mounted hierarchy, to remove a task from its current cgroup you must move it into a new cgroup (possibly the root cgroup) by writing to the new cgroup's tasks file.”h]”hŒîNote: Since every task is always a member of exactly one cgroup in each mounted hierarchy, to remove a task from its current cgroup you must move it into a new cgroup (possibly the root cgroup) by writing to the new cgroup’s tasks file.”…”�”}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÑhj/h²hubhÌ)�”}”(hŒoNote: Due to some restrictions enforced by some cgroup subsystems, moving a process to another cgroup can fail.”h]”hŒoNote: Due to some restrictions enforced by some cgroup subsystems, moving a process to another cgroup can fail.”…”�”}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÖhj/h²hubeh}”(h]”Œattaching-processes”ah ]”h"]”Œ2.2 attaching processes”ah$]”h&]”uh1hµhj5h²hh³hÊh´M¹ubh¶)�”}”(hhh]”(h»)�”}”(hŒ 2.3 Mounting hierarchies by name”h]”hŒ 2.3 Mounting hierarchies by name”…”�”}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¸h²hh³hÊh´MÚubhÌ)�”}”(hX,Passing the name= option when mounting a cgroups hierarchy associates the given name with the hierarchy. This can be used when mounting a pre-existing hierarchy, in order to refer to it by name rather than by its set of active subsystems. Each hierarchy is either nameless, or has a unique name.”h]”hX,Passing the name= option when mounting a cgroups hierarchy associates the given name with the hierarchy. This can be used when mounting a pre-existing hierarchy, in order to refer to it by name rather than by its set of active subsystems. Each hierarchy is either nameless, or has a unique name.”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MÜhj¸h²hubhÌ)�”}”(hŒThe name should match [\w.-]+”h]”hŒThe name should match [w.-]+”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mâhj¸h²hubhÌ)�”}”(hŒâWhen passing a name= option for a new hierarchy, you need to specify subsystems manually; the legacy behaviour of mounting all subsystems when none are explicitly specified is not supported when you give a subsystem a name.”h]”hŒâWhen passing a name= option for a new hierarchy, you need to specify subsystems manually; the legacy behaviour of mounting all subsystems when none are explicitly specified is not supported when you give a subsystem a name.”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mähj¸h²hubhÌ)�”}”(hŒoThe name of the subsystem appears as part of the hierarchy description in /proc/mounts and /proc//cgroups.”h]”hŒoThe name of the subsystem appears as part of the hierarchy description in /proc/mounts and /proc//cgroups.”…”�”}”(hjóh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Méhj¸h²hubeh}”(h]”Œmounting-hierarchies-by-name”ah ]”h"]”Œ 2.3 mounting hierarchies by name”ah$]”h&]”uh1hµhj5h²hh³hÊh´MÚubeh}”(h]”Œusage-examples-and-syntax”ah ]”h"]”Œ2. usage examples and syntax”ah$]”h&]”uh1hµhh·h²hh³hÊh´MZubh¶)�”}”(hhh]”(h»)�”}”(hŒ 3. Kernel API”h]”hŒ 3. Kernel API”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj h²hh³hÊh´Mîubh¶)�”}”(hhh]”(h»)�”}”(hŒ 3.1 Overview”h]”hŒ 3.1 Overview”…”�”}”(hj% h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj" h²hh³hÊh´MñubhÌ)�”}”(hXEach kernel subsystem that wants to hook into the generic cgroup system needs to create a cgroup_subsys object. This contains various methods, which are callbacks from the cgroup system, along with a subsystem ID which will be assigned by the cgroup system.”h]”hXEach kernel subsystem that wants to hook into the generic cgroup system needs to create a cgroup_subsys object. This contains various methods, which are callbacks from the cgroup system, along with a subsystem ID which will be assigned by the cgroup system.”…”�”}”(hj3 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Móhj" h²hubhÌ)�”}”(hŒ1Other fields in the cgroup_subsys object include:”h]”hŒ1Other fields in the cgroup_subsys object include:”…”�”}”(hjA h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Møhj" h²hubj})�”}”(hhh]”(j‚)�”}”(hŒ�subsys_id: a unique array index for the subsystem, indicating which entry in cgroup->subsys[] this subsystem should be managing. ”h]”hÌ)�”}”(hŒ€subsys_id: a unique array index for the subsystem, indicating which entry in cgroup->subsys[] this subsystem should be managing.”h]”hŒ€subsys_id: a unique array index for the subsystem, indicating which entry in cgroup->subsys[] this subsystem should be managing.”…”�”}”(hjV h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MúhjR ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjO h²hh³hÊh´Nubj‚)�”}”(hŒjname: should be initialized to a unique subsystem name. Should be no longer than MAX_CGROUP_TYPE_NAMELEN. ”h]”hÌ)�”}”(hŒiname: should be initialized to a unique subsystem name. Should be no longer than MAX_CGROUP_TYPE_NAMELEN.”h]”hŒiname: should be initialized to a unique subsystem name. Should be no longer than MAX_CGROUP_TYPE_NAMELEN.”…”�”}”(hjn h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mýhjj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjO h²hh³hÊh´Nubj‚)�”}”(hŒQearly_init: indicate if the subsystem needs early initialization at system boot. ”h]”hÌ)�”}”(hŒPearly_init: indicate if the subsystem needs early initialization at system boot.”h]”hŒPearly_init: indicate if the subsystem needs early initialization at system boot.”…”�”}”(hj† h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj‚ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjO h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jéjêuh1j|h³hÊh´Múhj" h²hubhÌ)�”}”(hŒÅEach cgroup object created by the system has an array of pointers, indexed by subsystem ID; this pointer is entirely managed by the subsystem; the generic cgroup code will never touch this pointer.”h]”hŒÅEach cgroup object created by the system has an array of pointers, indexed by subsystem ID; this pointer is entirely managed by the subsystem; the generic cgroup code will never touch this pointer.”…”�”}”(hj  h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj" h²hubeh}”(h]”Œoverview”ah ]”h"]”Œ 3.1 overview”ah$]”h&]”uh1hµhj h²hh³hÊh´Mñubh¶)�”}”(hhh]”(h»)�”}”(hŒ3.2 Synchronization”h]”hŒ3.2 Synchronization”…”�”}”(hj¹ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¶ h²hh³hÊh´MubhÌ)�”}”(hXThere is a global mutex, cgroup_mutex, used by the cgroup system. This should be taken by anything that wants to modify a cgroup. It may also be taken to prevent cgroups from being modified, but more specific locks may be more appropriate in that situation.”h]”hXThere is a global mutex, cgroup_mutex, used by the cgroup system. This should be taken by anything that wants to modify a cgroup. It may also be taken to prevent cgroups from being modified, but more specific locks may be more appropriate in that situation.”…”�”}”(hjÇ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj¶ h²hubhÌ)�”}”(hŒ,See kernel/cgroup/cgroup.c for more details.”h]”hŒ,See kernel/cgroup/cgroup.c for more details.”…”�”}”(hjÕ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj¶ h²hubhÌ)�”}”(hŒ]Subsystems can take/release the cgroup_mutex via the functions cgroup_lock()/cgroup_unlock().”h]”hŒ]Subsystems can take/release the cgroup_mutex via the functions cgroup_lock()/cgroup_unlock().”…”�”}”(hjã h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj¶ h²hubhÌ)�”}”(hŒÓAccessing a task's cgroup pointer may be done in the following ways: - while holding cgroup_mutex - while holding the task's alloc_lock (via task_lock()) - inside an rcu_read_lock() section via rcu_dereference()”h]”hŒ×Accessing a task’s cgroup pointer may be done in the following ways: - while holding cgroup_mutex - while holding the task’s alloc_lock (via task_lock()) - inside an rcu_read_lock() section via rcu_dereference()”…”�”}”(hjñ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj¶ h²hubeh}”(h]”Œsynchronization”ah ]”h"]”Œ3.2 synchronization”ah$]”h&]”uh1hµhj h²hh³hÊh´Mubh¶)�”}”(hhh]”(h»)�”}”(hŒ3.3 Subsystem API”h]”hŒ3.3 Subsystem API”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj h²hh³hÊh´MubhÌ)�”}”(hŒEach subsystem should:”h]”hŒEach subsystem should:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj h²hubj})�”}”(hhh]”(j‚)�”}”(hŒ%add an entry in linux/cgroup_subsys.h”h]”hÌ)�”}”(hj+ h]”hŒ%add an entry in linux/cgroup_subsys.h”…”�”}”(hj- h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mhj) ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj& h²hh³hÊh´Nubj‚)�”}”(hŒ8define a cgroup_subsys object called _cgrp_subsys ”h]”hÌ)�”}”(hŒ7define a cgroup_subsys object called _cgrp_subsys”h]”hŒ7define a cgroup_subsys object called _cgrp_subsys”…”�”}”(hjD h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj@ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj& h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jéjêuh1j|h³hÊh´Mhj h²hubhÌ)�”}”(hŒžEach subsystem may export the following methods. The only mandatory methods are css_alloc/free. Any others that are null are presumed to be successful no-ops.”h]”hŒžEach subsystem may export the following methods. The only mandatory methods are css_alloc/free. Any others that are null are presumed to be successful no-ops.”…”�”}”(hj^ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M"hj h²hubhÌ)�”}”(hŒ\``struct cgroup_subsys_state *css_alloc(struct cgroup *cgrp)`` (cgroup_mutex held by caller)”h]”(hŒliteral”“”)�”}”(hŒ>``struct cgroup_subsys_state *css_alloc(struct cgroup *cgrp)``”h]”hŒ:struct cgroup_subsys_state *css_alloc(struct cgroup *cgrp)”…”�”}”(hjr h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjl ubhŒ (cgroup_mutex held by caller)”…”�”}”(hjl h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M&hj h²hubhÌ)�”}”(hXªCalled to allocate a subsystem state object for a cgroup. The subsystem should allocate its subsystem state object for the passed cgroup, returning a pointer to the new object on success or a ERR_PTR() value. On success, the subsystem pointer should point to a structure of type cgroup_subsys_state (typically embedded in a larger subsystem-specific object), which will be initialized by the cgroup system. Note that this will be called at initialization to create the root subsystem state for this subsystem; this case can be identified by the passed cgroup object having a NULL parent (since it's the root of the hierarchy) and may be an appropriate place for initialization code.”h]”hX¬Called to allocate a subsystem state object for a cgroup. The subsystem should allocate its subsystem state object for the passed cgroup, returning a pointer to the new object on success or a ERR_PTR() value. On success, the subsystem pointer should point to a structure of type cgroup_subsys_state (typically embedded in a larger subsystem-specific object), which will be initialized by the cgroup system. Note that this will be called at initialization to create the root subsystem state for this subsystem; this case can be identified by the passed cgroup object having a NULL parent (since it’s the root of the hierarchy) and may be an appropriate place for initialization code.”…”�”•O}”(hjŠ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M)hj h²hubhÌ)�”}”(hŒE``int css_online(struct cgroup *cgrp)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒ'``int css_online(struct cgroup *cgrp)``”h]”hŒ#int css_online(struct cgroup *cgrp)”…”�”}”(hjœ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj˜ ubhŒ (cgroup_mutex held by caller)”…”�”}”(hj˜ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M5hj h²hubhÌ)�”}”(hXeCalled after @cgrp successfully completed all allocations and made visible to cgroup_for_each_child/descendant_*() iterators. The subsystem may choose to fail creation by returning -errno. This callback can be used to implement reliable state sharing and propagation along the hierarchy. See the comment on cgroup_for_each_live_descendant_pre() for details.”h]”hXeCalled after @cgrp successfully completed all allocations and made visible to cgroup_for_each_child/descendant_*() iterators. The subsystem may choose to fail creation by returning -errno. This callback can be used to implement reliable state sharing and propagation along the hierarchy. See the comment on cgroup_for_each_live_descendant_pre() for details.”…”�”}”(hj´ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hj h²hubhÌ)�”}”(hŒH``void css_offline(struct cgroup *cgrp);`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒ*``void css_offline(struct cgroup *cgrp);``”h]”hŒ&void css_offline(struct cgroup *cgrp);”…”�”}”(hjÆ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj ubhŒ (cgroup_mutex held by caller)”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M?hj h²hubhÌ)�”}”(hX•This is the counterpart of css_online() and called iff css_online() has succeeded on @cgrp. This signifies the beginning of the end of @cgrp. @cgrp is being removed and the subsystem should start dropping all references it's holding on @cgrp. When all references are dropped, cgroup removal will proceed to the next step - css_free(). After this callback, @cgrp should be considered dead to the subsystem.”h]”hX—This is the counterpart of css_online() and called iff css_online() has succeeded on @cgrp. This signifies the beginning of the end of @cgrp. @cgrp is being removed and the subsystem should start dropping all references it’s holding on @cgrp. When all references are dropped, cgroup removal will proceed to the next step - css_free(). After this callback, @cgrp should be considered dead to the subsystem.”…”�”}”(hjÞ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MBhj h²hubhÌ)�”}”(hŒD``void css_free(struct cgroup *cgrp)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒ&``void css_free(struct cgroup *cgrp)``”h]”hŒ"void css_free(struct cgroup *cgrp)”…”�”}”(hjð h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjì ubhŒ (cgroup_mutex held by caller)”…”�”}”(hjì h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MIhj h²hubhÌ)�”}”(hXQThe cgroup system is about to free @cgrp; the subsystem should free its subsystem state object. By the time this method is called, @cgrp is completely unused; @cgrp->parent is still valid. (Note - can also be called for a newly-created cgroup if an error occurs after this subsystem's create() method has been called for the new cgroup).”h]”hXSThe cgroup system is about to free @cgrp; the subsystem should free its subsystem state object. By the time this method is called, @cgrp is completely unused; @cgrp->parent is still valid. (Note - can also be called for a newly-created cgroup if an error occurs after this subsystem’s create() method has been called for the new cgroup).”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MLhj h²hubhÌ)�”}”(hŒb``int can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒD``int can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)``”h]”hŒ@int can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj ubhŒ (cgroup_mutex held by caller)”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MRhj h²hubhÌ)�”}”(hŒÛCalled prior to moving one or more tasks into a cgroup; if the subsystem returns an error, this will abort the attach operation. @tset contains the tasks to be attached and is guaranteed to have at least one task in it.”h]”hŒÛCalled prior to moving one or more tasks into a cgroup; if the subsystem returns an error, this will abort the attach operation. @tset contains the tasks to be attached and is guaranteed to have at least one task in it.”…”�”}”(hj2 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MUhj h²hubhŒdefinition_list”“”)�”}”(hhh]”hŒdefinition_list_item”“”)�”}”(hŒçIf there are multiple tasks in the taskset, then: - it's guaranteed that all are from the same thread group - @tset contains all tasks from the thread group whether or not they're switching cgroups - the first task is the leader ”h]”(hŒterm”“”)�”}”(hŒ1If there are multiple tasks in the taskset, then:”h]”hŒ1If there are multiple tasks in the taskset, then:”…”�”}”(hjM h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jK h³hÊh´M^hjG ubhŒ definition”“”)�”}”(hhh]”j})�”}”(hhh]”(j‚)�”}”(hŒ7it's guaranteed that all are from the same thread group”h]”hÌ)�”}”(hje h]”hŒ9it’s guaranteed that all are from the same thread group”…”�”}”(hjg h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M[hjc ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj` ubj‚)�”}”(hŒW@tset contains all tasks from the thread group whether or not they're switching cgroups”h]”hÌ)�”}”(hŒW@tset contains all tasks from the thread group whether or not they're switching cgroups”h]”hŒY@tset contains all tasks from the thread group whether or not they’re switching cgroups”…”�”}”(hj~ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M\hjz ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj` ubj‚)�”}”(hŒthe first task is the leader ”h]”hÌ)�”}”(hŒthe first task is the leader”h]”hŒthe first task is the leader”…”�”}”(hj– h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M^hj’ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj` ubeh}”(h]”h ]”h"]”h$]”h&]”jéjêuh1j|h³hÊh´M[hj] ubah}”(h]”h ]”h"]”h$]”h&]”uh1j[ hjG ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jE h³hÊh´M^hjB ubah}”(h]”h ]”h"]”h$]”h&]”uh1j@ hj h²hh³Nh´NubhÌ)�”}”(hX€Each @tset entry also contains the task's old cgroup and tasks which aren't switching cgroup can be skipped easily using the cgroup_taskset_for_each() iterator. Note that this isn't called on a fork. If this method returns 0 (success) then this should remain valid while the caller holds cgroup_mutex and it is ensured that either attach() or cancel_attach() will be called in future.”h]”hX†Each @tset entry also contains the task’s old cgroup and tasks which aren’t switching cgroup can be skipped easily using the cgroup_taskset_for_each() iterator. Note that this isn’t called on a fork. If this method returns 0 (success) then this should remain valid while the caller holds cgroup_mutex and it is ensured that either attach() or cancel_attach() will be called in future.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M`hj h²hubhÌ)�”}”(hŒQ``void css_reset(struct cgroup_subsys_state *css)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒ3``void css_reset(struct cgroup_subsys_state *css)``”h]”hŒ/void css_reset(struct cgroup_subsys_state *css)”…”�”}”(hjÔ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjÐ ubhŒ (cgroup_mutex held by caller)”…”�”}”(hjÐ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mghj h²hubhÌ)�”}”(hXeAn optional operation which should restore @css's configuration to the initial state. This is currently only used on the unified hierarchy when a subsystem is disabled on a cgroup through "cgroup.subtree_control" but should remain enabled because other subsystems depend on it. cgroup core makes such a css invisible by removing the associated interface files and invokes this callback so that the hidden subsystem can return to the initial neutral state. This prevents unexpected resource control from a hidden css and ensures that the configuration is in the initial state when it is made visible again later.”h]”hXkAn optional operation which should restore @css’s configuration to the initial state. This is currently only used on the unified hierarchy when a subsystem is disabled on a cgroup through “cgroup.subtree_controlâ€� but should remain enabled because other subsystems depend on it. cgroup core makes such a css invisible by removing the associated interface files and invokes this callback so that the hidden subsystem can return to the initial neutral state. This prevents unexpected resource control from a hidden css and ensures that the configuration is in the initial state when it is made visible again later.”…”�”}”(hjì h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mjhj h²hubhÌ)�”}”(hŒf``void cancel_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒH``void cancel_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)``”h]”hŒDvoid cancel_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)”…”�”}”(hjþ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjú ubhŒ (cgroup_mutex held by caller)”…”�”}”(hjú h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Muhj h²hubhÌ)�”}”(hXoCalled when a task attach operation has failed after can_attach() has succeeded. A subsystem whose can_attach() has some side-effects should provide this function, so that the subsystem can implement a rollback. If not, not necessary. This will be called only about subsystems whose can_attach() operation have succeeded. The parameters are identical to can_attach().”h]”hXoCalled when a task attach operation has failed after can_attach() has succeeded. A subsystem whose can_attach() has some side-effects should provide this function, so that the subsystem can implement a rollback. If not, not necessary. This will be called only about subsystems whose can_attach() operation have succeeded. The parameters are identical to can_attach().”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mxhj h²hubhÌ)�”}”(hŒ_``void attach(struct cgroup *cgrp, struct cgroup_taskset *tset)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒA``void attach(struct cgroup *cgrp, struct cgroup_taskset *tset)``”h]”hŒ=void attach(struct cgroup *cgrp, struct cgroup_taskset *tset)”…”�”}”(hj( h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj$ ubhŒ (cgroup_mutex held by caller)”…”�”}”(hj$ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M~hj h²hubhÌ)�”}”(hŒ¸Called after the task has been attached to the cgroup, to allow any post-attachment activity that requires memory allocations or blocking. The parameters are identical to can_attach().”h]”hŒ¸Called after the task has been attached to the cgroup, to allow any post-attachment activity that requires memory allocations or blocking. The parameters are identical to can_attach().”…”�”}”(hj@ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hj h²hubhÌ)�”}”(hŒ'``void fork(struct task_struct *task)``”h]”jq )�”}”(hjP h]”hŒ#void fork(struct task_struct *task)”…”�”}”(hjR h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjN ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M…hj h²hubhÌ)�”}”(hŒ+Called when a task is forked into a cgroup.”h]”hŒ+Called when a task is forked into a cgroup.”…”�”}”(hje h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‡hj h²hubhÌ)�”}”(hŒ'``void exit(struct task_struct *task)``”h]”jq )�”}”(hju h]”hŒ#void exit(struct task_struct *task)”…”�”}”(hjw h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hjs ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‰hj h²hubhÌ)�”}”(hŒCalled during task exit.”h]”hŒCalled during task exit.”…”�”}”(hjŠ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‹hj h²hubhÌ)�”}”(hŒ'``void free(struct task_struct *task)``”h]”jq )�”}”(hjš h]”hŒ#void free(struct task_struct *task)”…”�”}”(hjœ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj˜ ubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hj h²hubhÌ)�”}”(hŒ%Called when the task_struct is freed.”h]”hŒ%Called when the task_struct is freed.”…”�”}”(hj¯ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hj h²hubhÌ)�”}”(hŒ@``void bind(struct cgroup *root)`` (cgroup_mutex held by caller)”h]”(jq )�”}”(hŒ"``void bind(struct cgroup *root)``”h]”hŒvoid bind(struct cgroup *root)”…”�”}”(hjÁ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jp hj½ ubhŒ (cgroup_mutex held by caller)”…”�”}”(hj½ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M‘hj h²hubhÌ)�”}”(hX Called when a cgroup subsystem is rebound to a different hierarchy and root cgroup. Currently this will only involve movement between the default hierarchy (which never has sub-cgroups) and a hierarchy that is being created/destroyed (and hence has no sub-cgroups).”h]”hX Called when a cgroup subsystem is rebound to a different hierarchy and root cgroup. Currently this will only involve movement between the default hierarchy (which never has sub-cgroups) and a hierarchy that is being created/destroyed (and hence has no sub-cgroups).”…”�”}”(hjÙ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M”hj h²hubeh}”(h]”Œ subsystem-api”ah ]”h"]”Œ3.3 subsystem api”ah$]”h&]”uh1hµhj h²hh³hÊh´Mubeh}”(h]”Œ kernel-api”ah ]”h"]”Œ 3. kernel api”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mîubh¶)�”}”(hhh]”(h»)�”}”(hŒ4. Extended attribute usage”h]”hŒ4. Extended attribute usage”…”�”}”(hjú h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj÷ h²hh³hÊh´MšubhÌ)�”}”(hŒcgroup filesystem supports certain types of extended attributes in its directories and files. The current supported types are:”h]”hŒcgroup filesystem supports certain types of extended attributes in its directories and files. The current supported types are:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mœhj÷ h²hubjw)�”}”(hŒ6- Trusted (XATTR_TRUSTED) - Security (XATTR_SECURITY) ”h]”j})�”}”(hhh]”(j‚)�”}”(hŒTrusted (XATTR_TRUSTED)”h]”hÌ)�”}”(hj h]”hŒTrusted (XATTR_TRUSTED)”…”�”}”(hj! h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŸhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj ubj‚)�”}”(hŒSecurity (XATTR_SECURITY) ”h]”hÌ)�”}”(hŒSecurity (XATTR_SECURITY)”h]”hŒSecurity (XATTR_SECURITY)”…”�”}”(hj8 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M hj4 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj ubeh}”(h]”h ]”h"]”h$]”h&]”jéjêuh1j|h³hÊh´MŸhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jvh³hÊh´MŸhj÷ h²hubhÌ)�”}”(hŒ-Both require CAP_SYS_ADMIN capability to set.”h]”hŒ-Both require CAP_SYS_ADMIN capability to set.”…”�”}”(hjX h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¢hj÷ h²hubhÌ)�”}”(hXLike in tmpfs, the extended attributes in cgroup filesystem are stored using kernel memory and it's advised to keep the usage at minimum. This is the reason why user defined extended attributes are not supported, since any user can do it and there's no limit in the value size.”h]”hXLike in tmpfs, the extended attributes in cgroup filesystem are stored using kernel memory and it’s advised to keep the usage at minimum. This is the reason why user defined extended attributes are not supported, since any user can do it and there’s no limit in the value size.”…”�”}”(hjf h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M¤hj÷ h²hubhÌ)�”}”(hŒ½The current known users for this feature are SELinux to limit cgroup usage in containers and systemd for assorted meta data like main PID in a cgroup (systemd creates a cgroup per service).”h]”hŒ½The current known users for this feature are SELinux to limit cgroup usage in containers and systemd for assorted meta data like main PID in a cgroup (systemd creates a cgroup per service).”…”�”}”(hjt h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M©hj÷ h²hubeh}”(h]”Œextended-attribute-usage”ah ]”h"]”Œ4. extended attribute usage”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mšubh¶)�”}”(hhh]”(h»)�”}”(hŒ 5. Questions”h]”hŒ 5. Questions”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjŠ h²hh³hÊh´M®ubj½)�”}”(hX–Q: what's up with this '/bin/echo' ? A: bash's builtin 'echo' command does not check calls to write() against errors. If you use it in the cgroup file system, you won't be able to tell whether a command succeeded or failed. Q: When I attach processes, only the first of the line gets really attached ! A: We can only return one error code per call to write(). So you should also put only ONE PID.”h]”hX–Q: what's up with this '/bin/echo' ? A: bash's builtin 'echo' command does not check calls to write() against errors. If you use it in the cgroup file system, you won't be able to tell whether a command succeeded or failed. Q: When I attach processes, only the first of the line gets really attached ! A: We can only return one error code per call to write(). So you should also put only ONE PID.”…”�”}”hj› sbah}”(h]”h ]”h"]”h$]”h&]”jojpuh1j¼h³hÊh´M²hjŠ h²hubeh}”(h]”Œ questions”ah ]”h"]”Œ 5. questions”ah$]”h&]”uh1hµhh·h²hh³hÊh´M®ubeh}”(h]”Œcontrol-groups”ah ]”h"]”Œcontrol groups”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jÜ Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”jH]”j=asŒnameids”}”(j¶ j³ j2j/jNjKjPjHjOjLj‹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« uŒ nametypes”}”(j¶ ‰j2‰jN‰jPˆjO‰j‹‰j²‰jÙ‰j*‰j ‰j,‰jµ‰j ‰jô ‰j³ ‰j ‰jì ‰j‡ ‰j® ‰uh}”(j³ h·j/jqjKj‚jHjQjLjQjˆjWj¯jŽjÖjµj'jÜj j5j)jFj²j/j j¸jñ j j° j" j j¶ jé j j„ j÷ j« jŠ uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jê Ks…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)�”}”(hhh]”hÌ)�”}”(hhh]”hŒ8Hyperlink target "cgroups-why-needed" is not referenced.”…”�”}”hjFsbah}”(h]”h ]”h"]”h$]”h&]”uh1hËhjCubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÊŒline”KSuh1jAubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.