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 4/4] exit: avoid sig->count in __exit_signal() to detect the group-dead case
Date: Wed, 17 Mar 2010 20:29:01 +0100 [thread overview]
Message-ID: <20100317192901.GA2109@redhat.com> (raw)
Change __exit_signal() to check thread_group_leader() instead of
atomic_dec_and_test(&sig->count). This must be equivalent, the
group leader must be released only after all other threads have
exited and passed __exit_signal().
>From now sig->count is not actually used, except in fs/proc for
get_nr_threads/etc.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
--- 34-rc1/kernel/exit.c~4_EXIT_SIGNAL 2010-03-17 19:37:18.000000000 +0100
+++ 34-rc1/kernel/exit.c 2010-03-17 20:05:38.000000000 +0100
@@ -89,11 +89,12 @@ static void __exit_signal(struct task_st
rcu_read_lock_held() ||
lockdep_is_held(&tasklist_lock));
spin_lock(&sighand->siglock);
+ atomic_dec(&sig->count);
posix_cpu_timers_exit(tsk);
- if (atomic_dec_and_test(&sig->count))
+ if (thread_group_leader(tsk)) {
posix_cpu_timers_exit_group(tsk);
- else {
+ } else {
/*
* If there is any task waiting for the group exit
* then notify it:
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=20100317192901.GA2109@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox