From: Oleg Nesterov Date: Wed, 30 Apr 2008 07:52:52 +0000 (-0700) Subject: signals: microoptimize the usage of ->curr_target X-Git-Tag: v2.6.26-rc1~290 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db51aeccd7097ce19a522a4c5ff91c320f870e2b;p=linux-2.6 signals: microoptimize the usage of ->curr_target Suggested by Roland McGrath. Initialize signal->curr_target in copy_signal(). This way ->curr_target is never == NULL, we can kill the check in __group_complete_signal's hot path. Signed-off-by: Oleg Nesterov Cc: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/fork.c b/kernel/fork.c index 068ffe0075..2bb675af4d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -892,7 +892,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) sig->group_exit_code = 0; sig->group_exit_task = NULL; sig->group_stop_count = 0; - sig->curr_target = NULL; + sig->curr_target = tsk; init_sigpending(&sig->shared_pending); INIT_LIST_HEAD(&sig->posix_timers); diff --git a/kernel/signal.c b/kernel/signal.c index 17859f0d84..0298bd3d43 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -863,10 +863,6 @@ __group_complete_signal(int sig, struct task_struct *p) * Otherwise try to find a suitable thread. */ t = signal->curr_target; - if (t == NULL) - /* restart balancing at this thread */ - t = signal->curr_target = p; - while (!wants_signal(sig, t)) { t = next_thread(t); if (t == signal->curr_target)