signals: microoptimize the usage of ->curr_target
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 30 Apr 2008 07:52:52 +0000 (00:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Apr 2008 15:29:35 +0000 (08:29 -0700)
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 <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/fork.c
kernel/signal.c

index 068ffe007529155dfc7b6d199c2afbd9219d8b74..2bb675af4de30908b2dd1a22e745541e2bcbc3f5 100644 (file)
@@ -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);
 
index 17859f0d8411e1925d3cb1962da37752331fbacf..0298bd3d431be0f33b59ff5eba603ad6168fdbeb 100644 (file)
@@ -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)