mirror of https://github.com/mkerrisk/man-pages
cgroups.7: Clarify discussion of the "tasks" file
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
9ed582ac20
commit
87402a2e5b
|
@ -222,20 +222,32 @@ A new cgroup is created by creating a directory in the cgroup filesystem:
|
||||||
mkdir /sys/fs/cgroup/cpu/cg1
|
mkdir /sys/fs/cgroup/cpu/cg1
|
||||||
|
|
||||||
This creates a new empty cgroup.
|
This creates a new empty cgroup.
|
||||||
Processes (threads) may be moved to this cgroup by writing
|
Processes may be moved to this cgroup by writing
|
||||||
their PIDs (TIDs) into the cgroup's
|
their PIDs into the cgroup's
|
||||||
.I cgroup.procs
|
.I cgroup.procs
|
||||||
.RI ( tasks )
|
|
||||||
file:
|
file:
|
||||||
|
|
||||||
echo $$ > /sys/fs/cgroup/cpu/cg1/cgroup.procs
|
echo $$ > /sys/fs/cgroup/cpu/cg1/cgroup.procs
|
||||||
|
|
||||||
The same files can be read to obtain a list of the processes (threads)
|
The same file can be read to obtain a list of the processes
|
||||||
that are currently in
|
that are currently in
|
||||||
.IR cg1 .
|
.IR cg1 .
|
||||||
When writing a PID into the
|
When writing a PID into the
|
||||||
.IR cgroup.procs ,
|
.IR cgroup.procs ,
|
||||||
all tasks in the process are moved into the new cgroup at once.
|
all threads in the process are moved into the new cgroup at once.
|
||||||
|
|
||||||
|
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
|
||||||
|
.BR clone (2)
|
||||||
|
and
|
||||||
|
.BR gettid (2))
|
||||||
|
to the
|
||||||
|
.IR tasks
|
||||||
|
file in a cgroup directory.
|
||||||
|
This file can be read to discover the set of threads
|
||||||
|
that are members of the cgroup.
|
||||||
|
This file is not present in cgroup v2 directories.
|
||||||
|
|
||||||
A child process created via
|
A child process created via
|
||||||
.BR fork (2)
|
.BR fork (2)
|
||||||
|
|
Loading…
Reference in New Issue