mirror of https://github.com/mkerrisk/man-pages
cgroups.7: Add some details to discussion of cgroup.procs file
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
31ec2a5cf7
commit
f524e7f8c7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue