linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] move the related code from exit_notify() to exit_signals()
Date: Thu, 6 Dec 2007 16:56:45 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0712061651480.6399@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <20071206162244.GA9878@tv-sign.ru>

On Thu, 6 Dec 2007, Oleg Nesterov wrote:

> The previous bugfix was not optimal, we shouldn't care about group stop when
> we are the only thread or the group stop is in progress. In that case nothing
> special is needed, just set PF_EXITING and return.
> 
> Also, take the related "TIF_SIGPENDING re-targeting" code from exit_notify().
> 
> So, from the performance POV the only difference is that we don't trust
> !signal_pending() until we take ->siglock. But this in fact fixes another
> ___pure___ theoretical minor race. __group_complete_signal() finds the task
> without PF_EXITING and chooses it as the target for signal_wake_up(). But
> nothing prevents this task from exiting in between without noticing the
> pending signal and thus unpredictably delaying the actual delivery.

For a second there, you got me confused, since it wasn't clear to me this 
patch was going over the previous one. When posting patches that are not 
in any tree, it may be wise to include the set they nest onto ;)


> +	if (!signal_pending(tsk))
> +		goto out;
> +
> +	/* It could be that __group_complete_signal() choose us to
> +	 * notify about group-wide signal. Another thread should be
> +	 * woken now to take the signal since we will not.
> +	 */
> +	for (t = tsk; (t = next_thread(t)) != tsk; )
> +		if (!signal_pending(t) && !(t->flags & PF_EXITING))
> +			recalc_sigpending_and_wake(t);
> +
> +	if (unlikely(tsk->signal->group_stop_count) &&
> +			!--tsk->signal->group_stop_count) {
> +		tsk->signal->flags = SIGNAL_STOP_STOPPED;
> +		group_stop = 1;
> +	}
> +out:

Looks fine to me, even though the one above could simply be an:

if (signal_pending(tsk)) {
	...
}

(since the "out" label is used by that "if" only).



- Davide



      reply	other threads:[~2007-12-07  0:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-06 16:22 [PATCH] move the related code from exit_notify() to exit_signals() Oleg Nesterov
2007-12-07  0:56 ` Davide Libenzi [this message]

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=Pine.LNX.4.64.0712061651480.6399@alien.or.mcafeemobile.com \
    --to=davidel@xmailserver.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=roland@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).