aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@us.ibm.com>2007-10-19 02:40:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:38 -0400
commit4c3f2ead5a3dff9069a45560ba4d007c8ae2e2ee (patch)
treeab47621edf01f64485c99cf2cde56762339c86f1 /include
parent60347f6716aa49831ac311e04d77ccdc50dc024a (diff)
pid namespaces: introduce struct upid
Since task will be visible from different pid namespaces each of them have to be addressed by multiple pids. struct upid is to store the information about which id refers to which namespace. The constuciton looks like this. Each struct pid carried the reference counter and the list of tasks attached to this pid. At its end it has a variable length array of struct upid-s. Each struct upid has a numerical id (pid itself), pointer to the namespace, this ID is valid in and is hashed into a pid_hash for searching the pids. The nr and pid_chain fields are kept in struct pid for a while to make kernel still work (no patch initialize the upids yet), but it will be removed at the end of this series when we switch to upids completely. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Paul Menage <menage@google.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/init_task.h6
-rw-r--r--include/linux/pid.h16
2 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d4b2f1c76e12..243e287304d0 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -103,6 +103,12 @@ extern struct group_info init_groups;
103 { .first = &init_task.pids[PIDTYPE_SID].node }, \ 103 { .first = &init_task.pids[PIDTYPE_SID].node }, \
104 }, \ 104 }, \
105 .rcu = RCU_HEAD_INIT, \ 105 .rcu = RCU_HEAD_INIT, \
106 .level = 0, \
107 .numbers = { { \
108 .nr = 0, \
109 .ns = &init_pid_ns, \
110 .pid_chain = { .next = NULL, .pprev = NULL }, \
111 }, } \
106} 112}
107 113
108#define INIT_PID_LINK(type) \ 114#define INIT_PID_LINK(type) \
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 1e0e4e3423a6..e5865a9c58a6 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -40,6 +40,20 @@ enum pid_type
40 * processes. 40 * processes.
41 */ 41 */
42 42
43
44/*
45 * struct upid is used to get the id of the struct pid, as it is
46 * seen in particular namespace. Later the struct pid is found with
47 * find_pid_ns() using the int nr and struct pid_namespace *ns.
48 */
49
50struct upid {
51 /* Try to keep pid_chain in the same cacheline as nr for find_pid */
52 int nr;
53 struct pid_namespace *ns;
54 struct hlist_node pid_chain;
55};
56
43struct pid 57struct pid
44{ 58{
45 atomic_t count; 59 atomic_t count;
@@ -49,6 +63,8 @@ struct pid
49 /* lists of tasks that use this pid */ 63 /* lists of tasks that use this pid */
50 struct hlist_head tasks[PIDTYPE_MAX]; 64 struct hlist_head tasks[PIDTYPE_MAX];
51 struct rcu_head rcu; 65 struct rcu_head rcu;
66 int level;
67 struct upid numbers[1];
52}; 68};
53 69
54extern struct pid init_struct_pid; 70extern struct pid init_struct_pid;