aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2009-09-23 18:56:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-24 10:21:00 -0400
commit989264f4645c183331a1279d513f4b1ddc06e1f5 (patch)
tree44dc1d6ae0ba66229a6b9e85ac22a3edc87a4b8d /kernel
parent5c01ba49e6647d86bc7576105f82027200d1f303 (diff)
do_wait-wakeup-optimization: simplify task_pid_type()
task_pid_type() is only used by eligible_pid() which has to check wo_type != PIDTYPE_MAX anyway. Remove this check from task_pid_type() and factor out ->pids[type] access, this shrinks .text a bit and simplifies the code. The matches the behaviour of other similar helpers, say get_task_pid(). The caller must ensure that pid_type is valid, not the callee. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Roland McGrath <roland@redhat.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 'kernel')
-rw-r--r--kernel/exit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 3fb9a77863d..650c1d1a55d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1101,17 +1101,15 @@ struct wait_opts {
1101 int notask_error; 1101 int notask_error;
1102}; 1102};
1103 1103
1104static struct pid *task_pid_type(struct task_struct *task, enum pid_type type) 1104static inline
1105struct pid *task_pid_type(struct task_struct *task, enum pid_type type)
1105{ 1106{
1106 struct pid *pid = NULL; 1107 if (type != PIDTYPE_PID)
1107 if (type == PIDTYPE_PID) 1108 task = task->group_leader;
1108 pid = task->pids[type].pid; 1109 return task->pids[type].pid;
1109 else if (type < PIDTYPE_MAX)
1110 pid = task->group_leader->pids[type].pid;
1111 return pid;
1112} 1110}
1113 1111
1114static inline int eligible_pid(struct wait_opts *wo, struct task_struct *p) 1112static int eligible_pid(struct wait_opts *wo, struct task_struct *p)
1115{ 1113{
1116 return wo->wo_type == PIDTYPE_MAX || 1114 return wo->wo_type == PIDTYPE_MAX ||
1117 task_pid_type(p, wo->wo_type) == wo->wo_pid; 1115 task_pid_type(p, wo->wo_type) == wo->wo_pid;