[PATCH] signals: microoptimize the usage of ->curr_target

From: Oleg Nesterov
Date: Fri Mar 07 2008 - 06:57:45 EST


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@xxxxxxxxxx>

--- 25/kernel/fork.c~4_CURR_TASK 2008-02-17 23:40:09.000000000 +0300
+++ 25/kernel/fork.c 2008-03-07 14:50:52.000000000 +0300
@@ -902,7 +902,7 @@ static int copy_signal(unsigned long clo
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);

--- 25/kernel/signal.c~4_CURR_TASK 2008-03-07 13:59:09.000000000 +0300
+++ 25/kernel/signal.c 2008-03-07 14:51:58.000000000 +0300
@@ -863,10 +863,6 @@ __group_complete_signal(int sig, struct
* 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/