From: Jarek Poplawski <jarkao2@o2.pl>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] do_sigaction: don't worry about signal_pending()
Date: Wed, 22 Aug 2007 12:53:29 +0200 [thread overview]
Message-ID: <20070822105329.GG1684@ff.dom.local> (raw)
In-Reply-To: <20070822100210.GA139@tv-sign.ru>
On Wed, Aug 22, 2007 at 02:02:10PM +0400, Oleg Nesterov wrote:
> On 08/22, Jarek Poplawski wrote:
> >
> > On 20-08-2007 18:01, Oleg Nesterov wrote:
> > > do_sigaction() returns -ERESTARTNOINTR if signal_pending(). The comment says:
> > >
> > > * If there might be a fatal signal pending on multiple
> > > * threads, make sure we take it before changing the action.
> > >
> > > I think this is not needed. We should only worry about SIGNAL_GROUP_EXIT case,
> > > bit it implies a pending SIGKILL which can't be cleared by do_sigaction.
> >
> > Isn't it for optimization e.g., to skip this 'do while' loop below for
> > such multiple threads, which would get SIGKILL or SIGSTOP anyway?
>
> Yes, in that case this 'do while' doesn't make sense. But this is very
> unlikely, sigaction() shouldn't be called too much often, better to save
> a couple of bytes from icache.
>
> Also, please note that sigaction() is not special, almost any system call
> could be started with
>
> if (current->signal->flags & SIGNAL_GROUP_EXIT)
> return ANYVALUE;
>
> to "optimize" for the case when the task is dying.
OK, I only wasn't sure this was considered before getting this
"not needed" verdict.
BTW, sometimes, even if something is very unlikely, but very
time-consuming, and skipping this isn't so costly, there could be
a gain at the end. So, maybe it's about individual cases and some
testing too? (At least, it seems, somebody found this so usable,
she/he bothered with such a long comment, and we know it's a last
thing any decent kernel hacker would care to do...)
Jarek P.
prev parent reply other threads:[~2007-08-22 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 16:01 [PATCH] do_sigaction: don't worry about signal_pending() Oleg Nesterov
2007-08-20 18:53 ` Roland McGrath
2007-08-22 9:43 ` Jarek Poplawski
2007-08-22 10:02 ` Oleg Nesterov
2007-08-22 10:53 ` Jarek Poplawski [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=20070822105329.GG1684@ff.dom.local \
--to=jarkao2@o2.pl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--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