[PATCH 2/4] coredump: speedup SIGKILL sending

From: Oleg Nesterov
Date: Thu Apr 06 2006 - 14:09:41 EST


With this patch a thread group is killed atomically under ->siglock.
This is faster because we can use sigaddset() instead of force_sig_info()
and this is used in further patches.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--- rc1/fs/exec.c~2_KILL 2006-04-06 15:10:28.000000000 +0400
+++ rc1/fs/exec.c 2006-04-06 15:19:33.000000000 +0400
@@ -1387,17 +1387,24 @@ static void format_corename(char *corena
static void zap_process(struct task_struct *start, int *ptraced)
{
struct task_struct *t;
+ unsigned long flags;
+
+ spin_lock_irqsave(&start->sighand->siglock, flags);

t = start;
do {
if (t != current && t->mm) {
t->mm->core_waiters++;
- force_sig_specific(SIGKILL, t);
+ sigaddset(&t->pending.signal, SIGKILL);
+ signal_wake_up(t, 1);
+
if (unlikely(t->ptrace) &&
unlikely(t->parent->mm == t->mm))
*ptraced = 1;
}
} while ((t = next_thread(t)) != start);
+
+ spin_unlock_irqrestore(&start->sighand->siglock, flags);
}

static void zap_threads (struct mm_struct *mm)

-
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/