aboutsummaryrefslogtreecommitdiffstats
path: root/man7/cgroups.7
diff options
context:
space:
mode:
Diffstat (limited to 'man7/cgroups.7')
-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