Skip to content

Commit f6e07d3

Browse files
jo-sotorvalds
authored andcommitted
Documentation: update cgroupfs mount point
According to commit 676db4a ("cgroupfs: create /sys/fs/cgroup to mount cgroupfs on") the canonical mountpoint for the cgroup filesystem is /sys/fs/cgroup. Hence, this should be used in the documentation. Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de> Acked-by: Paul Menage <menage@google.com> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 06a2c45 commit f6e07d3

11 files changed

Lines changed: 109 additions & 94 deletions

File tree

‎Documentation/accounting/cgroupstats.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ information will not be available.
2121
To extract cgroup statistics a utility very similar to getdelays.c
2222
has been developed, the sample output of the utility is shown below
2323

24-
~/balbir/cgroupstats # ./getdelays -C "/cgroup/a"
24+
~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup/a"
2525
sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0
26-
~/balbir/cgroupstats # ./getdelays -C "/cgroup"
26+
~/balbir/cgroupstats # ./getdelays -C "/sys/fs/cgroup"
2727
sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2

‎Documentation/cgroups/blkio-controller.txt‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,19 @@ cgroups. Here is what you can do.
2828
- Enable group scheduling in CFQ
2929
CONFIG_CFQ_GROUP_IOSCHED=y
3030

31-
- Compile and boot into kernel and mount IO controller (blkio).
31+
- Compile and boot into kernel and mount IO controller (blkio); see
32+
cgroups.txt, Why are cgroups needed?.
3233

33-
mount -t cgroup -o blkio none /cgroup
34+
mount -t tmpfs cgroup_root /sys/fs/cgroup
35+
mkdir /sys/fs/cgroup/blkio
36+
mount -t cgroup -o blkio none /sys/fs/cgroup/blkio
3437

3538
- Create two cgroups
36-
mkdir -p /cgroup/test1/ /cgroup/test2
39+
mkdir -p /sys/fs/cgroup/blkio/test1/ /sys/fs/cgroup/blkio/test2
3740

3841
- Set weights of group test1 and test2
39-
echo 1000 > /cgroup/test1/blkio.weight
40-
echo 500 > /cgroup/test2/blkio.weight
42+
echo 1000 > /sys/fs/cgroup/blkio/test1/blkio.weight
43+
echo 500 > /sys/fs/cgroup/blkio/test2/blkio.weight
4144

4245
- Create two same size files (say 512MB each) on same disk (file1, file2) and
4346
launch two dd threads in different cgroup to read those files.
@@ -46,12 +49,12 @@ cgroups. Here is what you can do.
4649
echo 3 > /proc/sys/vm/drop_caches
4750

4851
dd if=/mnt/sdb/zerofile1 of=/dev/null &
49-
echo $! > /cgroup/test1/tasks
50-
cat /cgroup/test1/tasks
52+
echo $! > /sys/fs/cgroup/blkio/test1/tasks
53+
cat /sys/fs/cgroup/blkio/test1/tasks
5154

5255
dd if=/mnt/sdb/zerofile2 of=/dev/null &
53-
echo $! > /cgroup/test2/tasks
54-
cat /cgroup/test2/tasks
56+
echo $! > /sys/fs/cgroup/blkio/test2/tasks
57+
cat /sys/fs/cgroup/blkio/test2/tasks
5558

5659
- At macro level, first dd should finish first. To get more precise data, keep
5760
on looking at (with the help of script), at blkio.disk_time and
@@ -68,13 +71,13 @@ Throttling/Upper Limit policy
6871
- Enable throttling in block layer
6972
CONFIG_BLK_DEV_THROTTLING=y
7073

71-
- Mount blkio controller
72-
mount -t cgroup -o blkio none /cgroup/blkio
74+
- Mount blkio controller (see cgroups.txt, Why are cgroups needed?)
75+
mount -t cgroup -o blkio none /sys/fs/cgroup/blkio
7376

7477
- Specify a bandwidth rate on particular device for root group. The format
7578
for policy is "<major>:<minor> <byes_per_second>".
7679

77-
echo "8:16 1048576" > /cgroup/blkio/blkio.read_bps_device
80+
echo "8:16 1048576" > /sys/fs/cgroup/blkio/blkio.read_bps_device
7881

7982
Above will put a limit of 1MB/second on reads happening for root group
8083
on device having major/minor number 8:16.
@@ -149,7 +152,7 @@ Proportional weight policy files
149152

150153
Following is the format.
151154

152-
#echo dev_maj:dev_minor weight > /path/to/cgroup/blkio.weight_device
155+
# echo dev_maj:dev_minor weight > blkio.weight_device
153156
Configure weight=300 on /dev/sdb (8:16) in this cgroup
154157
# echo 8:16 300 > blkio.weight_device
155158
# cat blkio.weight_device

‎Documentation/cgroups/cgroups.txt‎

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ With the ability to classify tasks differently for different resources
138138
the admin can easily set up a script which receives exec notifications
139139
and 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

143143
With only a single hierarchy, he now would potentially have to create
144144
a separate cgroup for every browser launched and associate it with
@@ -153,9 +153,9 @@ apps enhanced CPU power,
153153
With ability to write pids directly to resource classes, it's just a
154154
matter 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

160160
Without this ability, he would have to split the cgroup into
161161
multiple separate ones and then associate the new cgroups with the
@@ -310,21 +310,24 @@ subsystem, this is the case for the cpuset.
310310
To start a new job that is to be contained within a cgroup, using
311311
the "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

322323
For example, the following sequence of commands will setup a cgroup
323324
named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
324325
and 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
345348
virtual filesystem.
346349

347350
To 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

350353
The "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,
354357
if cpusets are enabled the user will have to populate the cpus and mems files
355358
for 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+
357369
To mount a cgroup hierarchy with just the cpuset and memory
358370
subsystems, type:
359-
# mount -t cgroup -o cpuset,memory hier1 /dev/cgroup
371+
# mount -t cgroup -o cpuset,memory hier1 /sys/fs/cgroup/rg1
360372

361373
To change the set of subsystems bound to a mounted hierarchy, just
362374
remount with different options:
363-
# mount -o remount,cpuset,blkio hier1 /dev/cgroup
375+
# mount -o remount,cpuset,blkio hier1 /sys/fs/cgroup/rg1
364376

365377
Now memory is removed from the hierarchy and blkio is added.
366378

367379
Note this will add blkio to the hierarchy but won't remove memory or
368380
cpuset, 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

371383
To 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

375387
Note 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
379391
the ability to arbitrarily bind/unbind subsystems from an existing
380392
cgroup 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
384396
is the cgroup that holds the whole system.
385397

386398
If 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

389401
It 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

395407
Now you want to do something with this cgroup.

‎Documentation/cgroups/cpuacct.txt‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@ directly present in its group.
1010

1111
Accounting groups can be created by first mounting the cgroup filesystem.
1212

13-
# mkdir /cgroups
14-
# mount -t cgroup -ocpuacct none /cgroups
15-
16-
With the above step, the initial or the parent accounting group
17-
becomes visible at /cgroups. At bootup, this group includes all the
18-
tasks in the system. /cgroups/tasks lists the tasks in this cgroup.
19-
/cgroups/cpuacct.usage gives the CPU time (in nanoseconds) obtained by
20-
this group which is essentially the CPU time obtained by all the tasks
13+
# mount -t cgroup -ocpuacct none /sys/fs/cgroup
14+
15+
With the above step, the initial or the parent accounting group becomes
16+
visible at /sys/fs/cgroup. At bootup, this group includes all the tasks in
17+
the system. /sys/fs/cgroup/tasks lists the tasks in this cgroup.
18+
/sys/fs/cgroup/cpuacct.usage gives the CPU time (in nanoseconds) obtained
19+
by this group which is essentially the CPU time obtained by all the tasks
2120
in the system.
2221

23-
New accounting groups can be created under the parent group /cgroups.
22+
New accounting groups can be created under the parent group /sys/fs/cgroup.
2423

25-
# cd /cgroups
24+
# cd /sys/fs/cgroup
2625
# mkdir g1
2726
# echo $$ > g1
2827

2928
The above steps create a new group g1 and move the current shell
3029
process (bash) into it. CPU time consumed by this bash and its children
3130
can be obtained from g1/cpuacct.usage and the same is accumulated in
32-
/cgroups/cpuacct.usage also.
31+
/sys/fs/cgroup/cpuacct.usage also.
3332

3433
cpuacct.stat file lists a few statistics which further divide the
3534
CPU time obtained by the cgroup into user and system times. Currently

‎Documentation/cgroups/cpusets.txt‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -661,21 +661,21 @@ than stress the kernel.
661661

662662
To start a new job that is to be contained within a cpuset, the steps are:
663663

664-
1) mkdir /dev/cpuset
665-
2) mount -t cgroup -ocpuset cpuset /dev/cpuset
664+
1) mkdir /sys/fs/cgroup/cpuset
665+
2) mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset
666666
3) Create the new cpuset by doing mkdir's and write's (or echo's) in
667-
the /dev/cpuset virtual file system.
667+
the /sys/fs/cgroup/cpuset virtual file system.
668668
4) Start a task that will be the "founding father" of the new job.
669669
5) Attach that task to the new cpuset by writing its pid to the
670-
/dev/cpuset tasks file for that cpuset.
670+
/sys/fs/cgroup/cpuset tasks file for that cpuset.
671671
6) fork, exec or clone the job tasks from this founding father task.
672672

673673
For example, the following sequence of commands will setup a cpuset
674674
named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
675675
and then start a subshell 'sh' in that cpuset:
676676

677-
mount -t cgroup -ocpuset cpuset /dev/cpuset
678-
cd /dev/cpuset
677+
mount -t cgroup -ocpuset cpuset /sys/fs/cgroup/cpuset
678+
cd /sys/fs/cgroup/cpuset
679679
mkdir Charlie
680680
cd Charlie
681681
/bin/echo 2-3 > cpuset.cpus
@@ -710,14 +710,14 @@ Creating, modifying, using the cpusets can be done through the cpuset
710710
virtual filesystem.
711711

712712
To mount it, type:
713-
# mount -t cgroup -o cpuset cpuset /dev/cpuset
713+
# mount -t cgroup -o cpuset cpuset /sys/fs/cgroup/cpuset
714714

715-
Then under /dev/cpuset you can find a tree that corresponds to the
716-
tree of the cpusets in the system. For instance, /dev/cpuset
715+
Then under /sys/fs/cgroup/cpuset you can find a tree that corresponds to the
716+
tree of the cpusets in the system. For instance, /sys/fs/cgroup/cpuset
717717
is the cpuset that holds the whole system.
718718

719-
If you want to create a new cpuset under /dev/cpuset:
720-
# cd /dev/cpuset
719+
If you want to create a new cpuset under /sys/fs/cgroup/cpuset:
720+
# cd /sys/fs/cgroup/cpuset
721721
# mkdir my_cpuset
722722

723723
Now you want to do something with this cpuset.
@@ -765,12 +765,12 @@ wrapper around the cgroup filesystem.
765765

766766
The command
767767

768-
mount -t cpuset X /dev/cpuset
768+
mount -t cpuset X /sys/fs/cgroup/cpuset
769769

770770
is equivalent to
771771

772-
mount -t cgroup -ocpuset,noprefix X /dev/cpuset
773-
echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent
772+
mount -t cgroup -ocpuset,noprefix X /sys/fs/cgroup/cpuset
773+
echo "/sbin/cpuset_release_agent" > /sys/fs/cgroup/cpuset/release_agent
774774

775775
2.2 Adding/removing cpus
776776
------------------------

‎Documentation/cgroups/devices.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ removed from the child(ren).
2222
An entry is added using devices.allow, and removed using
2323
devices.deny. For instance
2424

25-
echo 'c 1:3 mr' > /cgroups/1/devices.allow
25+
echo 'c 1:3 mr' > /sys/fs/cgroup/1/devices.allow
2626

2727
allows cgroup 1 to read and mknod the device usually known as
2828
/dev/null. Doing
2929

30-
echo a > /cgroups/1/devices.deny
30+
echo a > /sys/fs/cgroup/1/devices.deny
3131

3232
will remove the default 'a *:* rwm' entry. Doing
3333

34-
echo a > /cgroups/1/devices.allow
34+
echo a > /sys/fs/cgroup/1/devices.allow
3535

3636
will add the 'a *:* rwm' entry to the whitelist.
3737

‎Documentation/cgroups/freezer-subsystem.txt‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,28 @@ is non-freezable.
5959

6060
* Examples of usage :
6161

62-
# mkdir /containers
63-
# mount -t cgroup -ofreezer freezer /containers
64-
# mkdir /containers/0
65-
# echo $some_pid > /containers/0/tasks
62+
# mkdir /sys/fs/cgroup/freezer
63+
# mount -t cgroup -ofreezer freezer /sys/fs/cgroup/freezer
64+
# mkdir /sys/fs/cgroup/freezer/0
65+
# echo $some_pid > /sys/fs/cgroup/freezer/0/tasks
6666

6767
to get status of the freezer subsystem :
6868

69-
# cat /containers/0/freezer.state
69+
# cat /sys/fs/cgroup/freezer/0/freezer.state
7070
THAWED
7171

7272
to freeze all tasks in the container :
7373

74-
# echo FROZEN > /containers/0/freezer.state
75-
# cat /containers/0/freezer.state
74+
# echo FROZEN > /sys/fs/cgroup/freezer/0/freezer.state
75+
# cat /sys/fs/cgroup/freezer/0/freezer.state
7676
FREEZING
77-
# cat /containers/0/freezer.state
77+
# cat /sys/fs/cgroup/freezer/0/freezer.state
7878
FROZEN
7979

8080
to unfreeze all tasks in the container :
8181

82-
# echo THAWED > /containers/0/freezer.state
83-
# cat /containers/0/freezer.state
82+
# echo THAWED > /sys/fs/cgroup/freezer/0/freezer.state
83+
# cat /sys/fs/cgroup/freezer/0/freezer.state
8484
THAWED
8585

8686
This is the basic mechanism which should do the right thing for user space task

0 commit comments

Comments
 (0)