From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Roland McGrath <roland@redhat.com>,
Veaceslav Falico <vfalico@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] exit: change zap_other_threads() to count sub-threads
Date: Wed, 17 Mar 2010 20:28:54 +0100 [thread overview]
Message-ID: <20100317192854.GA2097@redhat.com> (raw)
Change zap_other_threads() to return the number of other sub-threads
found on ->thread_group list.
Other changes are cosmetic:
- change the code to use while_each_thread() helper
- remove the obsolete comment about SIGKILL/SIGSTOP
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
include/linux/sched.h | 2 +-
kernel/signal.c | 17 +++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
--- 34-rc1/include/linux/sched.h~2_ZAP_COUNT_THREADS 2010-03-17 19:10:28.000000000 +0100
+++ 34-rc1/include/linux/sched.h 2010-03-17 19:20:11.000000000 +0100
@@ -2035,7 +2035,7 @@ extern int do_notify_parent(struct task_
extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
extern void force_sig(int, struct task_struct *);
extern int send_sig(int, struct task_struct *, int);
-extern void zap_other_threads(struct task_struct *p);
+extern int zap_other_threads(struct task_struct *p);
extern struct sigqueue *sigqueue_alloc(void);
extern void sigqueue_free(struct sigqueue *);
extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
--- 34-rc1/kernel/signal.c~2_ZAP_COUNT_THREADS 2010-03-17 19:10:28.000000000 +0100
+++ 34-rc1/kernel/signal.c 2010-03-17 19:20:11.000000000 +0100
@@ -1083,23 +1083,24 @@ force_sig_info(int sig, struct siginfo *
/*
* Nuke all other threads in the group.
*/
-void zap_other_threads(struct task_struct *p)
+int zap_other_threads(struct task_struct *p)
{
- struct task_struct *t;
+ struct task_struct *t = p;
+ int count = 0;
p->signal->group_stop_count = 0;
- for (t = next_thread(p); t != p; t = next_thread(t)) {
- /*
- * Don't bother with already dead threads
- */
+ while_each_thread(p, t) {
+ count++;
+
+ /* Don't bother with already dead threads */
if (t->exit_state)
continue;
-
- /* SIGKILL will be handled before any pending SIGSTOP */
sigaddset(&t->pending.signal, SIGKILL);
signal_wake_up(t, 1);
}
+
+ return count;
}
struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
reply other threads:[~2010-03-17 19:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100317192854.GA2097@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=vfalico@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.