aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cgroups
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2012-09-11 07:20:20 -0400
committerTejun Heo <tj@kernel.org>2012-09-13 14:10:54 -0400
commit83b061fc09489fb1b827f65cdca014c37ed224bb (patch)
tree81987533820ea304a14d4f4433f8682454ee9852 /Documentation/cgroups
parentb9d6cfdeaf67cc34cdfd53ab234358dd2910a0f4 (diff)
cgroup: trivial fixes for Documentation/cgroups/cgroups.txt
While reading through Documentation/cgroups/cgroups.txt, I found a number of minor wordos and typos. The patch below is a conservative handling of some of these: it provides just a number of "obviously correct" fixes to the English that improve the readability of the document somewhat. Obviously some more significant fixes could be made to the document, but some of those may not be in the "obviously correct" category. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'Documentation/cgroups')
-rw-r--r--Documentation/cgroups/cgroups.txt68
1 files changed, 34 insertions, 34 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index 004fd5a09e12..9e04196c4d78 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -63,9 +63,9 @@ an instance of the cgroup virtual filesystem associated with it.
63At any one time there may be multiple active hierarchies of task 63At any one time there may be multiple active hierarchies of task
64cgroups. Each hierarchy is a partition of all tasks in the system. 64cgroups. Each hierarchy is a partition of all tasks in the system.
65 65
66User level code may create and destroy cgroups by name in an 66User-level code may create and destroy cgroups by name in an
67instance of the cgroup virtual file system, specify and query to 67instance of the cgroup virtual file system, specify and query to
68which cgroup a task is assigned, and list the task pids assigned to 68which cgroup a task is assigned, and list the task PIDs assigned to
69a cgroup. Those creations and assignments only affect the hierarchy 69a cgroup. Those creations and assignments only affect the hierarchy
70associated with that instance of the cgroup file system. 70associated with that instance of the cgroup file system.
71 71
@@ -73,7 +73,7 @@ On their own, the only use for cgroups is for simple job
73tracking. The intention is that other subsystems hook into the generic 73tracking. The intention is that other subsystems hook into the generic
74cgroup support to provide new attributes for cgroups, such as 74cgroup support to provide new attributes for cgroups, such as
75accounting/limiting the resources which processes in a cgroup can 75accounting/limiting the resources which processes in a cgroup can
76access. For example, cpusets (see Documentation/cgroups/cpusets.txt) allows 76access. For example, cpusets (see Documentation/cgroups/cpusets.txt) allow
77you to associate a set of CPUs and a set of memory nodes with the 77you to associate a set of CPUs and a set of memory nodes with the
78tasks in each cgroup. 78tasks in each cgroup.
79 79
@@ -81,11 +81,11 @@ tasks in each cgroup.
81---------------------------- 81----------------------------
82 82
83There are multiple efforts to provide process aggregations in the 83There are multiple efforts to provide process aggregations in the
84Linux kernel, mainly for resource tracking purposes. Such efforts 84Linux kernel, mainly for resource-tracking purposes. Such efforts
85include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server 85include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server
86namespaces. These all require the basic notion of a 86namespaces. These all require the basic notion of a
87grouping/partitioning of processes, with newly forked processes ending 87grouping/partitioning of processes, with newly forked processes ending
88in the same group (cgroup) as their parent process. 88up in the same group (cgroup) as their parent process.
89 89
90The kernel cgroup patch provides the minimum essential kernel 90The kernel cgroup patch provides the minimum essential kernel
91mechanisms required to efficiently implement such groups. It has 91mechanisms required to efficiently implement such groups. It has
@@ -128,14 +128,14 @@ following lines:
128 / \ 128 / \
129 Professors (15%) students (5%) 129 Professors (15%) students (5%)
130 130
131Browsers like Firefox/Lynx go into the WWW network class, while (k)nfsd go 131Browsers like Firefox/Lynx go into the WWW network class, while (k)nfsd goes
132into NFS network class. 132into the NFS network class.
133 133
134At the same time Firefox/Lynx will share an appropriate CPU/Memory class 134At the same time Firefox/Lynx will share an appropriate CPU/Memory class
135depending on who launched it (prof/student). 135depending on who launched it (prof/student).
136 136
137With the ability to classify tasks differently for different resources 137With the ability to classify tasks differently for different resources
138(by putting those resource subsystems in different hierarchies) then 138(by putting those resource subsystems in different hierarchies),
139the admin can easily set up a script which receives exec notifications 139the admin can easily set up a script which receives exec notifications
140and depending on who is launching the browser he can 140and depending on who is launching the browser he can
141 141
@@ -146,19 +146,19 @@ a separate cgroup for every browser launched and associate it with
146appropriate network and other resource class. This may lead to 146appropriate network and other resource class. This may lead to
147proliferation of such cgroups. 147proliferation of such cgroups.
148 148
149Also lets say that the administrator would like to give enhanced network 149Also let's say that the administrator would like to give enhanced network
150access temporarily to a student's browser (since it is night and the user 150access temporarily to a student's browser (since it is night and the user
151wants to do online gaming :)) OR give one of the students simulation 151wants to do online gaming :)) OR give one of the student's simulation
152apps enhanced CPU power, 152apps enhanced CPU power.
153 153
154With ability to write pids directly to resource classes, it's just a 154With ability to write PIDs directly to resource classes, it's just a
155matter of : 155matter of:
156 156
157 # echo pid > /sys/fs/cgroup/network/<new_class>/tasks 157 # echo pid > /sys/fs/cgroup/network/<new_class>/tasks
158 (after some time) 158 (after some time)
159 # echo pid > /sys/fs/cgroup/network/<orig_class>/tasks 159 # echo pid > /sys/fs/cgroup/network/<orig_class>/tasks
160 160
161Without this ability, he would have to split the cgroup into 161Without this ability, the administrator would have to split the cgroup into
162multiple separate ones and then associate the new cgroups with the 162multiple separate ones and then associate the new cgroups with the
163new resource classes. 163new resource classes.
164 164
@@ -185,20 +185,20 @@ Control Groups extends the kernel as follows:
185 field of each task_struct using the css_set, anchored at 185 field of each task_struct using the css_set, anchored at
186 css_set->tasks. 186 css_set->tasks.
187 187
188 - A cgroup hierarchy filesystem can be mounted for browsing and 188 - A cgroup hierarchy filesystem can be mounted for browsing and
189 manipulation from user space. 189 manipulation from user space.
190 190
191 - You can list all the tasks (by pid) attached to any cgroup. 191 - You can list all the tasks (by PID) attached to any cgroup.
192 192
193The implementation of cgroups requires a few, simple hooks 193The implementation of cgroups requires a few, simple hooks
194into the rest of the kernel, none in performance critical paths: 194into the rest of the kernel, none in performance-critical paths:
195 195
196 - in init/main.c, to initialize the root cgroups and initial 196 - in init/main.c, to initialize the root cgroups and initial
197 css_set at system boot. 197 css_set at system boot.
198 198
199 - in fork and exit, to attach and detach a task from its css_set. 199 - in fork and exit, to attach and detach a task from its css_set.
200 200
201In addition a new file system, of type "cgroup" may be mounted, to 201In addition, a new file system of type "cgroup" may be mounted, to
202enable browsing and modifying the cgroups presently known to the 202enable browsing and modifying the cgroups presently known to the
203kernel. When mounting a cgroup hierarchy, you may specify a 203kernel. When mounting a cgroup hierarchy, you may specify a
204comma-separated list of subsystems to mount as the filesystem mount 204comma-separated list of subsystems to mount as the filesystem mount
@@ -231,13 +231,13 @@ as the path relative to the root of the cgroup file system.
231Each cgroup is represented by a directory in the cgroup file system 231Each cgroup is represented by a directory in the cgroup file system
232containing the following files describing that cgroup: 232containing the following files describing that cgroup:
233 233
234 - tasks: list of tasks (by pid) attached to that cgroup. This list 234 - tasks: list of tasks (by PID) attached to that cgroup. This list
235 is not guaranteed to be sorted. Writing a thread id into this file 235 is not guaranteed to be sorted. Writing a thread ID into this file
236 moves the thread into this cgroup. 236 moves the thread into this cgroup.
237 - cgroup.procs: list of tgids in the cgroup. This list is not 237 - cgroup.procs: list of thread group IDs in the cgroup. This list is
238 guaranteed to be sorted or free of duplicate tgids, and userspace 238 not guaranteed to be sorted or free of duplicate TGIDs, and userspace
239 should sort/uniquify the list if this property is required. 239 should sort/uniquify the list if this property is required.
240 Writing a thread group id into this file moves all threads in that 240 Writing a thread group ID into this file moves all threads in that
241 group into this cgroup. 241 group into this cgroup.
242 - notify_on_release flag: run the release agent on exit? 242 - notify_on_release flag: run the release agent on exit?
243 - release_agent: the path to use for release notifications (this file 243 - release_agent: the path to use for release notifications (this file
@@ -262,7 +262,7 @@ cgroup file system directories.
262 262
263When a task is moved from one cgroup to another, it gets a new 263When a task is moved from one cgroup to another, it gets a new
264css_set pointer - if there's an already existing css_set with the 264css_set pointer - if there's an already existing css_set with the
265desired collection of cgroups then that group is reused, else a new 265desired collection of cgroups then that group is reused, otherwise a new
266css_set is allocated. The appropriate existing css_set is located by 266css_set is allocated. The appropriate existing css_set is located by
267looking into a hash table. 267looking into a hash table.
268 268
@@ -293,7 +293,7 @@ file system) of the abandoned cgroup. This enables automatic
293removal of abandoned cgroups. The default value of 293removal of abandoned cgroups. The default value of
294notify_on_release in the root cgroup at system boot is disabled 294notify_on_release in the root cgroup at system boot is disabled
295(0). The default value of other cgroups at creation is the current 295(0). The default value of other cgroups at creation is the current
296value of their parents notify_on_release setting. The default value of 296value of their parents' notify_on_release settings. The default value of
297a cgroup hierarchy's release_agent path is empty. 297a cgroup hierarchy's release_agent path is empty.
298 298
2991.5 What does clone_children do ? 2991.5 What does clone_children do ?
@@ -317,7 +317,7 @@ the "cpuset" cgroup subsystem, the steps are something like:
317 4) Create the new cgroup by doing mkdir's and write's (or echo's) in 317 4) Create the new cgroup by doing mkdir's and write's (or echo's) in
318 the /sys/fs/cgroup virtual file system. 318 the /sys/fs/cgroup virtual file system.
319 5) Start a task that will be the "founding father" of the new job. 319 5) Start a task that will be the "founding father" of the new job.
320 6) Attach that task to the new cgroup by writing its pid to the 320 6) Attach that task to the new cgroup by writing its PID to the
321 /sys/fs/cgroup/cpuset/tasks file for that cgroup. 321 /sys/fs/cgroup/cpuset/tasks file for that cgroup.
322 7) fork, exec or clone the job tasks from this founding father task. 322 7) fork, exec or clone the job tasks from this founding father task.
323 323
@@ -345,7 +345,7 @@ and then start a subshell 'sh' in that cgroup:
3452.1 Basic Usage 3452.1 Basic Usage
346--------------- 346---------------
347 347
348Creating, modifying, using the cgroups can be done through the cgroup 348Creating, modifying, using cgroups can be done through the cgroup
349virtual filesystem. 349virtual filesystem.
350 350
351To mount a cgroup hierarchy with all available subsystems, type: 351To mount a cgroup hierarchy with all available subsystems, type:
@@ -442,7 +442,7 @@ You can attach the current shell task by echoing 0:
442# echo 0 > tasks 442# echo 0 > tasks
443 443
444You can use the cgroup.procs file instead of the tasks file to move all 444You can use the cgroup.procs file instead of the tasks file to move all
445threads in a threadgroup at once. Echoing the pid of any task in a 445threads in a threadgroup at once. Echoing the PID of any task in a
446threadgroup to cgroup.procs causes all tasks in that threadgroup to be 446threadgroup to cgroup.procs causes all tasks in that threadgroup to be
447be attached to the cgroup. Writing 0 to cgroup.procs moves all tasks 447be attached to the cgroup. Writing 0 to cgroup.procs moves all tasks
448in the writing task's threadgroup. 448in the writing task's threadgroup.
@@ -480,7 +480,7 @@ in /proc/mounts and /proc/<pid>/cgroups.
480There is mechanism which allows to get notifications about changing 480There is mechanism which allows to get notifications about changing
481status of a cgroup. 481status of a cgroup.
482 482
483To register new notification handler you need: 483To register a new notification handler you need to:
484 - create a file descriptor for event notification using eventfd(2); 484 - create a file descriptor for event notification using eventfd(2);
485 - open a control file to be monitored (e.g. memory.usage_in_bytes); 485 - open a control file to be monitored (e.g. memory.usage_in_bytes);
486 - write "<event_fd> <control_fd> <args>" to cgroup.event_control. 486 - write "<event_fd> <control_fd> <args>" to cgroup.event_control.
@@ -489,7 +489,7 @@ To register new notification handler you need:
489eventfd will be woken up by control file implementation or when the 489eventfd will be woken up by control file implementation or when the
490cgroup is removed. 490cgroup is removed.
491 491
492To unregister notification handler just close eventfd. 492To unregister a notification handler just close eventfd.
493 493
494NOTE: Support of notifications should be implemented for the control 494NOTE: Support of notifications should be implemented for the control
495file. See documentation for the subsystem. 495file. See documentation for the subsystem.
@@ -503,7 +503,7 @@ file. See documentation for the subsystem.
503Each kernel subsystem that wants to hook into the generic cgroup 503Each kernel subsystem that wants to hook into the generic cgroup
504system needs to create a cgroup_subsys object. This contains 504system needs to create a cgroup_subsys object. This contains
505various methods, which are callbacks from the cgroup system, along 505various methods, which are callbacks from the cgroup system, along
506with a subsystem id which will be assigned by the cgroup system. 506with a subsystem ID which will be assigned by the cgroup system.
507 507
508Other fields in the cgroup_subsys object include: 508Other fields in the cgroup_subsys object include:
509 509
@@ -517,7 +517,7 @@ Other fields in the cgroup_subsys object include:
517 at system boot. 517 at system boot.
518 518
519Each cgroup object created by the system has an array of pointers, 519Each cgroup object created by the system has an array of pointers,
520indexed by subsystem id; this pointer is entirely managed by the 520indexed by subsystem ID; this pointer is entirely managed by the
521subsystem; the generic cgroup code will never touch this pointer. 521subsystem; the generic cgroup code will never touch this pointer.
522 522
5233.2 Synchronization 5233.2 Synchronization
@@ -640,7 +640,7 @@ void post_clone(struct cgroup *cgrp)
640 640
641Called during cgroup_create() to do any parameter 641Called during cgroup_create() to do any parameter
642initialization which might be required before a task could attach. For 642initialization which might be required before a task could attach. For
643example in cpusets, no task may attach before 'cpus' and 'mems' are set 643example, in cpusets, no task may attach before 'cpus' and 'mems' are set
644up. 644up.
645 645
646void bind(struct cgroup *root) 646void bind(struct cgroup *root)
@@ -680,5 +680,5 @@ A: bash's builtin 'echo' command does not check calls to write() against
680 680
681Q: When I attach processes, only the first of the line gets really attached ! 681Q: When I attach processes, only the first of the line gets really attached !
682A: We can only return one error code per call to write(). So you should also 682A: We can only return one error code per call to write(). So you should also
683 put only ONE pid. 683 put only ONE PID.
684 684