From: Oleg Nesterov Date: Mon, 26 Jun 2006 07:26:06 +0000 (-0700) Subject: [PATCH] coredump: speedup SIGKILL sending X-Git-Tag: v2.6.18-rc1~739 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=281de339ceb822ca6c04d4373ecb9a45c1890ce4;p=linux-2.6 [PATCH] coredump: speedup SIGKILL sending 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 Cc: "Eric W. Biederman" Acked-by: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/exec.c b/fs/exec.c index 80fe7bcfa0..a5c51646d1 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1371,17 +1371,24 @@ static void format_corename(char *corename, const char *pattern, long signr) 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)