From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH 3/4] cleanup __exit_signal()
Date: Fri, 24 Feb 2006 10:01:54 -0800 [thread overview]
Message-ID: <20060224180154.GB1735@us.ibm.com> (raw)
In-Reply-To: <43F9E873.808CD086@tv-sign.ru>
On Mon, Feb 20, 2006 at 07:04:03PM +0300, Oleg Nesterov wrote:
> This patch factors out duplicated code under 'if' branches.
> Also, BUG_ON() conversions and whitespace cleanups.
Passed steamroller. Looks sane to me.
Thanx, Paul
Acked-by: <paulmck@us.ibm.com>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
> --- 2.6.16-rc3/kernel/signal.c~3_ESIG 2006-02-20 02:02:03.000000000 +0300
> +++ 2.6.16-rc3/kernel/signal.c 2006-02-20 20:55:50.000000000 +0300
> @@ -341,24 +341,20 @@ void __exit_sighand(struct task_struct *
> */
> void __exit_signal(struct task_struct *tsk)
> {
> - struct signal_struct * sig = tsk->signal;
> - struct sighand_struct * sighand;
> + struct signal_struct *sig = tsk->signal;
> + struct sighand_struct *sighand;
> +
> + BUG_ON(!sig);
> + BUG_ON(!atomic_read(&sig->count));
>
> - if (!sig)
> - BUG();
> - if (!atomic_read(&sig->count))
> - BUG();
> rcu_read_lock();
> sighand = rcu_dereference(tsk->sighand);
> spin_lock(&sighand->siglock);
> +
> posix_cpu_timers_exit(tsk);
> - if (atomic_dec_and_test(&sig->count)) {
> + if (atomic_dec_and_test(&sig->count))
> posix_cpu_timers_exit_group(tsk);
> - tsk->signal = NULL;
> - __exit_sighand(tsk);
> - spin_unlock(&sighand->siglock);
> - flush_sigqueue(&sig->shared_pending);
> - } else {
> + else {
> /*
> * If there is any task waiting for the group exit
> * then notify it:
> @@ -369,7 +365,6 @@ void __exit_signal(struct task_struct *t
> }
> if (tsk == sig->curr_target)
> sig->curr_target = next_thread(tsk);
> - tsk->signal = NULL;
> /*
> * Accumulate here the counters for all threads but the
> * group leader as they die, so they can be added into
> @@ -387,14 +382,18 @@ void __exit_signal(struct task_struct *t
> sig->nvcsw += tsk->nvcsw;
> sig->nivcsw += tsk->nivcsw;
> sig->sched_time += tsk->sched_time;
> - __exit_sighand(tsk);
> - spin_unlock(&sighand->siglock);
> - sig = NULL; /* Marker for below. */
> + sig = NULL; /* Marker for below. */
> }
> +
> + tsk->signal = NULL;
> + __exit_sighand(tsk);
> + spin_unlock(&sighand->siglock);
> rcu_read_unlock();
> +
> clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
> flush_sigqueue(&tsk->pending);
> if (sig) {
> + flush_sigqueue(&sig->shared_pending);
> __cleanup_signal(sig);
> }
> }
next prev parent reply other threads:[~2006-02-24 18:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-20 16:04 Oleg Nesterov
2006-02-24 18:01 ` Paul E. McKenney [this message]
2006-02-24 18:13 ` Oleg Nesterov
2006-02-25 0:20 ` Paul E. McKenney
2006-02-25 1:48 Suzanne Wood
2006-02-25 19:26 ` Oleg Nesterov
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=20060224180154.GB1735@us.ibm.com \
--to=paulmck@us.ibm.com \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--cc=roland@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
Powered by JetHome