@@ -138,7 +138,7 @@ With the ability to classify tasks differently for different resources
138138the admin can easily set up a script which receives exec notifications
139139and depending on who is launching the browser he can
140140
141- # echo browser_pid > /mnt /<restype>/<userclass>/tasks
141+ # echo browser_pid > /sys/fs/cgroup /<restype>/<userclass>/tasks
142142
143143With only a single hierarchy, he now would potentially have to create
144144a separate cgroup for every browser launched and associate it with
@@ -153,9 +153,9 @@ apps enhanced CPU power,
153153With ability to write pids directly to resource classes, it's just a
154154matter of :
155155
156- # echo pid > /mnt /network/<new_class>/tasks
156+ # echo pid > /sys/fs/cgroup /network/<new_class>/tasks
157157 (after some time)
158- # echo pid > /mnt /network/<orig_class>/tasks
158+ # echo pid > /sys/fs/cgroup /network/<orig_class>/tasks
159159
160160Without this ability, he would have to split the cgroup into
161161multiple separate ones and then associate the new cgroups with the
@@ -310,21 +310,24 @@ subsystem, this is the case for the cpuset.
310310To start a new job that is to be contained within a cgroup, using
311311the "cpuset" cgroup subsystem, the steps are something like:
312312
313- 1) mkdir /dev/cgroup
314- 2) mount -t cgroup -ocpuset cpuset /dev/cgroup
315- 3) Create the new cgroup by doing mkdir's and write's (or echo's) in
316- the /dev/cgroup virtual file system.
317- 4) Start a task that will be the "founding father" of the new job.
318- 5) Attach that task to the new cgroup by writing its pid to the
319- /dev/cgroup tasks file for that cgroup.
320- 6) fork, exec or clone the job tasks from this founding father task.
313+ 1) mount -t tmpfs cgroup_root /sys/fs/cgroup
314+ 2) mkdir /sys/fs/cgroup/cpuset
315+ 3) mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset
316+ 4) Create the new cgroup by doing mkdir's and write's (or echo's) in
317+ the /sys/fs/cgroup virtual file system.
318+ 5) Start a task that will be the "founding father" of the new job.
319+ 6) Attach that task to the new cgroup by writing its pid to the
320+ /sys/fs/cgroup/cpuset/tasks file for that cgroup.
321+ 7) fork, exec or clone the job tasks from this founding father task.
321322
322323For example, the following sequence of commands will setup a cgroup
323324named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
324325and then start a subshell 'sh' in that cgroup:
325326
326- mount -t cgroup cpuset -ocpuset /dev/cgroup
327- cd /dev/cgroup
327+ mount -t tmpfs cgroup_root /sys/fs/cgroup
328+ mkdir /sys/fs/cgroup/cpuset
329+ mount -t cgroup cpuset -ocpuset /sys/fs/cgroup/cpuset
330+ cd /sys/fs/cgroup/cpuset
328331 mkdir Charlie
329332 cd Charlie
330333 /bin/echo 2-3 > cpuset.cpus
@@ -345,7 +348,7 @@ Creating, modifying, using the cgroups can be done through the cgroup
345348virtual filesystem.
346349
347350To mount a cgroup hierarchy with all available subsystems, type:
348- # mount -t cgroup xxx /dev /cgroup
351+ # mount -t cgroup xxx /sys/fs /cgroup
349352
350353The "xxx" is not interpreted by the cgroup code, but will appear in
351354/proc/mounts so may be any useful identifying string that you like.
@@ -354,23 +357,32 @@ Note: Some subsystems do not work without some user input first. For instance,
354357if cpusets are enabled the user will have to populate the cpus and mems files
355358for each new cgroup created before that group can be used.
356359
360+ As explained in section `1.2 Why are cgroups needed?' you should create
361+ different hierarchies of cgroups for each single resource or group of
362+ resources you want to control. Therefore, you should mount a tmpfs on
363+ /sys/fs/cgroup and create directories for each cgroup resource or resource
364+ group.
365+
366+ # mount -t tmpfs cgroup_root /sys/fs/cgroup
367+ # mkdir /sys/fs/cgroup/rg1
368+
357369To mount a cgroup hierarchy with just the cpuset and memory
358370subsystems, type:
359- # mount -t cgroup -o cpuset,memory hier1 /dev/ cgroup
371+ # mount -t cgroup -o cpuset,memory hier1 /sys/fs/ cgroup/rg1
360372
361373To change the set of subsystems bound to a mounted hierarchy, just
362374remount with different options:
363- # mount -o remount,cpuset,blkio hier1 /dev/ cgroup
375+ # mount -o remount,cpuset,blkio hier1 /sys/fs/ cgroup/rg1
364376
365377Now memory is removed from the hierarchy and blkio is added.
366378
367379Note this will add blkio to the hierarchy but won't remove memory or
368380cpuset, because the new options are appended to the old ones:
369- # mount -o remount,blkio /dev/ cgroup
381+ # mount -o remount,blkio /sys/fs/ cgroup/rg1
370382
371383To Specify a hierarchy's release_agent:
372384# mount -t cgroup -o cpuset,release_agent="/sbin/cpuset_release_agent" \
373- xxx /dev/ cgroup
385+ xxx /sys/fs/ cgroup/rg1
374386
375387Note that specifying 'release_agent' more than once will return failure.
376388
@@ -379,17 +391,17 @@ when the hierarchy consists of a single (root) cgroup. Supporting
379391the ability to arbitrarily bind/unbind subsystems from an existing
380392cgroup hierarchy is intended to be implemented in the future.
381393
382- Then under /dev/ cgroup you can find a tree that corresponds to the
383- tree of the cgroups in the system. For instance, /dev/ cgroup
394+ Then under /sys/fs/ cgroup/rg1 you can find a tree that corresponds to the
395+ tree of the cgroups in the system. For instance, /sys/fs/ cgroup/rg1
384396is the cgroup that holds the whole system.
385397
386398If you want to change the value of release_agent:
387- # echo "/sbin/new_release_agent" > /dev/ cgroup/release_agent
399+ # echo "/sbin/new_release_agent" > /sys/fs/ cgroup/rg1 /release_agent
388400
389401It can also be changed via remount.
390402
391- If you want to create a new cgroup under /dev/ cgroup:
392- # cd /dev/ cgroup
403+ If you want to create a new cgroup under /sys/fs/ cgroup/rg1 :
404+ # cd /sys/fs/ cgroup/rg1
393405# mkdir my_cgroup
394406
395407Now you want to do something with this cgroup.
0 commit comments