diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-03-02 17:51:53 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-11-19 08:59:09 -0500 |
commit | 17cf22c33e1f1b5e435469c84e43872579497653 (patch) | |
tree | c5cec307c06f7e4ddc26e04e73c8833897b67113 /kernel/pid.c | |
parent | 49f4d8b93ccf9454284b6f524b96c66d8d7fbccc (diff) |
pidns: Use task_active_pid_ns where appropriate
The expressions tsk->nsproxy->pid_ns and task_active_pid_ns
aka ns_of_pid(task_pid(tsk)) should have the same number of
cache line misses with the practical difference that
ns_of_pid(task_pid(tsk)) is released later in a processes life.
Furthermore by using task_active_pid_ns it becomes trivial
to write an unshare implementation for the the pid namespace.
So I have used task_active_pid_ns everywhere I can.
In fork since the pid has not yet been attached to the
process I use ns_of_pid, to achieve the same effect.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 2a624f1486e1..3a5f238c1ca0 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns); | |||
345 | 345 | ||
346 | struct pid *find_vpid(int nr) | 346 | struct pid *find_vpid(int nr) |
347 | { | 347 | { |
348 | return find_pid_ns(nr, current->nsproxy->pid_ns); | 348 | return find_pid_ns(nr, task_active_pid_ns(current)); |
349 | } | 349 | } |
350 | EXPORT_SYMBOL_GPL(find_vpid); | 350 | EXPORT_SYMBOL_GPL(find_vpid); |
351 | 351 | ||
@@ -429,7 +429,7 @@ struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns) | |||
429 | 429 | ||
430 | struct task_struct *find_task_by_vpid(pid_t vnr) | 430 | struct task_struct *find_task_by_vpid(pid_t vnr) |
431 | { | 431 | { |
432 | return find_task_by_pid_ns(vnr, current->nsproxy->pid_ns); | 432 | return find_task_by_pid_ns(vnr, task_active_pid_ns(current)); |
433 | } | 433 | } |
434 | 434 | ||
435 | struct pid *get_task_pid(struct task_struct *task, enum pid_type type) | 435 | struct pid *get_task_pid(struct task_struct *task, enum pid_type type) |
@@ -484,7 +484,7 @@ EXPORT_SYMBOL_GPL(pid_nr_ns); | |||
484 | 484 | ||
485 | pid_t pid_vnr(struct pid *pid) | 485 | pid_t pid_vnr(struct pid *pid) |
486 | { | 486 | { |
487 | return pid_nr_ns(pid, current->nsproxy->pid_ns); | 487 | return pid_nr_ns(pid, task_active_pid_ns(current)); |
488 | } | 488 | } |
489 | EXPORT_SYMBOL_GPL(pid_vnr); | 489 | EXPORT_SYMBOL_GPL(pid_vnr); |
490 | 490 | ||
@@ -495,7 +495,7 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type, | |||
495 | 495 | ||
496 | rcu_read_lock(); | 496 | rcu_read_lock(); |
497 | if (!ns) | 497 | if (!ns) |
498 | ns = current->nsproxy->pid_ns; | 498 | ns = task_active_pid_ns(current); |
499 | if (likely(pid_alive(task))) { | 499 | if (likely(pid_alive(task))) { |
500 | if (type != PIDTYPE_PID) | 500 | if (type != PIDTYPE_PID) |
501 | task = task->group_leader; | 501 | task = task->group_leader; |