diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2012-05-31 19:26:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:32 -0400 |
commit | 818411616baf46ceba0cff6f05af3a9b294734f7 (patch) | |
tree | b6e338e20d4a45b6a05ffa37e6af33e0cc1b50c0 /Documentation/filesystems | |
parent | 98ed57eef9f67dfe541be0bca34660ffc88365b2 (diff) |
fs, proc: introduce /proc/<pid>/task/<tid>/children entry
When we do checkpoint of a task we need to know the list of children the
task, has but there is no easy and fast way to generate reverse
parent->children chain from arbitrary <pid> (while a parent pid is
provided in "PPid" field of /proc/<pid>/status).
So instead of walking over all pids in the system (creating one big
process tree in memory, just to figure out which children a task has) --
we add explicit /proc/<pid>/task/<tid>/children entry, because the kernel
already has this kind of information but it is not yet exported.
This is a first level children, not the whole process tree.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r-- | Documentation/filesystems/proc.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 912af6ce5626..d8d3f9a8e5a3 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -40,6 +40,7 @@ Table of Contents | |||
40 | 3.4 /proc/<pid>/coredump_filter - Core dump filtering settings | 40 | 3.4 /proc/<pid>/coredump_filter - Core dump filtering settings |
41 | 3.5 /proc/<pid>/mountinfo - Information about mounts | 41 | 3.5 /proc/<pid>/mountinfo - Information about mounts |
42 | 3.6 /proc/<pid>/comm & /proc/<pid>/task/<tid>/comm | 42 | 3.6 /proc/<pid>/comm & /proc/<pid>/task/<tid>/comm |
43 | 3.7 /proc/<pid>/task/<tid>/children - Information about task children | ||
43 | 44 | ||
44 | 4 Configuring procfs | 45 | 4 Configuring procfs |
45 | 4.1 Mount options | 46 | 4.1 Mount options |
@@ -1578,6 +1579,23 @@ then the kernel's TASK_COMM_LEN (currently 16 chars) will result in a truncated | |||
1578 | comm value. | 1579 | comm value. |
1579 | 1580 | ||
1580 | 1581 | ||
1582 | 3.7 /proc/<pid>/task/<tid>/children - Information about task children | ||
1583 | ------------------------------------------------------------------------- | ||
1584 | This file provides a fast way to retrieve first level children pids | ||
1585 | of a task pointed by <pid>/<tid> pair. The format is a space separated | ||
1586 | stream of pids. | ||
1587 | |||
1588 | Note the "first level" here -- if a child has own children they will | ||
1589 | not be listed here, one needs to read /proc/<children-pid>/task/<tid>/children | ||
1590 | to obtain the descendants. | ||
1591 | |||
1592 | Since this interface is intended to be fast and cheap it doesn't | ||
1593 | guarantee to provide precise results and some children might be | ||
1594 | skipped, especially if they've exited right after we printed their | ||
1595 | pids, so one need to either stop or freeze processes being inspected | ||
1596 | if precise results are needed. | ||
1597 | |||
1598 | |||
1581 | ------------------------------------------------------------------------------ | 1599 | ------------------------------------------------------------------------------ |
1582 | Configuring procfs | 1600 | Configuring procfs |
1583 | ------------------------------------------------------------------------------ | 1601 | ------------------------------------------------------------------------------ |