cgroup_namespaces.7: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-06-13 12:19:56 +02:00
parent 3a9ef8b72d
commit 32bc5a717a
1 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,7 @@ First, (as superuser) we create a child cgroup in the
.I freezer
hierarchy, and put the shell into that cgroup:
.PP
.EX
.nf
.in +4n
# \fBmkdir \-p /sys/fs/cgroup/freezer/sub\fP
@ -81,15 +82,18 @@ hierarchy, and put the shell into that cgroup:
7:freezer:/sub
.in
.fi
.EE
.PP
Next, we use
.BR unshare (1)
to create a process running a new shell in new cgroup and mount namespaces:
.PP
.nf
.EX
.in +4n
# \fBunshare \-Cm bash\fP
.in
.EE
.fi
.PP
We then inspect the
@ -102,6 +106,7 @@ with PID 1), and a process in a sibling cgroup
.RI ( sub2 ):
.PP
.nf
.EX
.in +4n
$ \fBcat /proc/self/cgroup | grep freezer\fP
7:freezer:/
@ -110,6 +115,7 @@ $ \fBcat /proc/1/cgroup | grep freezer\fP
$ \fBcat /proc/20124/cgroup | grep freezer\fP
7:freezer:/../sub2
.in
.EE
.fi
.PP
From the output of the first command,
@ -131,10 +137,12 @@ However, when we look in
we see the following anomaly:
.PP
.nf
.EX
.in +4n
# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 /.. /sys/fs/cgroup/freezer ...
.in
.EE
.fi
.PP
The fourth field of this line
@ -152,6 +160,7 @@ We need to remount the freezer cgroup filesystem
inside this cgroup namespace, after which we see the expected results:
.PP
.nf
.EX
.in +4n
# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events
# to other namespaces
@ -160,6 +169,7 @@ inside this cgroup namespace, after which we see the expected results:
# \fBcat /proc/self/mountinfo | grep freezer\fP
155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ...
.in
.EE
.fi
.PP
Use of cgroup namespaces requires a kernel that is configured with the