aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2016-10-07 14:04:43 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2016-10-08 14:08:23 +0200
commitf524e7f8c7c3b2af65bd08399c6f19527865957d (patch)
tree2acb918f329f5b900f2cce6af6e1ff01e1dd6ec0
parent31ec2a5cf7c7b71f7edec89a5d8dd3e14226f2a4 (diff)
downloadman-pages-f524e7f8c7c3b2af65bd08399c6f19527865957d.tar.gz
cgroups.7: Add some details to discussion of cgroup.procs file
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man7/cgroups.727
1 files changed, 22 insertions, 5 deletions
diff --git a/man7/cgroups.7 b/man7/cgroups.7
index 12ebbd30d7..13d50fa197 100644
--- a/man7/cgroups.7
+++ b/man7/cgroups.7
@@ -236,20 +236,37 @@ A new cgroup is created by creating a directory in the cgroup filesystem:
mkdir /sys/fs/cgroup/cpu/cg1
This creates a new empty cgroup.
-Processes may be moved to this cgroup by writing
-their PIDs into the cgroup's
+
+A process may be moved to this cgroup by writing its PID into the cgroup's
.I cgroup.procs
file:
echo $$ > /sys/fs/cgroup/cpu/cg1/cgroup.procs
-The same file can be read to obtain a list of the processes
-that are currently in
-.IR cg1 .
+Only one PID at a time should be written to this file.
+
+Writing the value 0 to a
+.IR cgroup.procs
+file causes the writing process to be moved to the corresponding cgroup.
+
When writing a PID into the
.IR cgroup.procs ,
all threads in the process are moved into the new cgroup at once.
+Within a hierarchy, a process can be a member of exactly one cgroup.
+Writing a process's PID to a
+.IR cgroup.procs
+file automatically removes it from the cgroup of
+which it was previously a member.
+
+The
+.I cgroup.procs
+file can be read to obtain a list of the processes that are
+members of a cgroup.
+The returned list of PIDs is not guaranteed to be in order.
+Nor is it guaranteed to be free of duplicates.
+(For example, a PID may be recycled while reading from the list.)
+
In cgroups v1 (but not cgroups v2), an individual thread can be moved to
another cgroup by writing its thread ID
(i.e., the kernel thread ID returned by