From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jerome Marchand <jmarchan@redhat.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ptrace_untrace: use wake_up_process() instead of bogus signal_wake_up()
Date: Mon, 9 Feb 2009 03:42:36 +0100 [thread overview]
Message-ID: <20090209024236.GB28280@redhat.com> (raw)
In-Reply-To: <20090209013804.C99B3FC330@magilla.sf.frob.com>
On 02/08, Roland McGrath wrote:
>
> > Both ptrace_stop() and do_signal_stop() pathes always take ->siglock and
> > do recalc_sigpending() after wakeup.
>
> Yes, that's true. But so what? Why is this a reason to introduce yet
> another unconditional (i.e. wrong) wake_up_process? signal_wake_up does
> the job fine, i.e. it calls wake_up_state the right way.
We are holding ->siglock, and task->state is TASK_TRACED. We can not do
the "wrong" wakeup, afaics.
And even if we forget about the unneeded TIF_SIGPENDING/kick_process,
personally I can't agree that signal_wake_up() uses wake_up_state()
more "correctly". This doesn't matter of course, but TASK_INTERRUPTIBLE
(and to some extent TASK_WAKEKILL) has nothing to do here, imho.
Of course, the tracee can already spin for ->siglock in TASK_RUNNING
when we do wake_up_process(), but this is true for signal_wake_up()
as well, and this is fine.
> For exactly the
> reasons you cited, setting TIF_SIGPENDING is both superfluous and
> harmless--its effects will happen upon resume whether it was set or not.
> So what's wrong with signal_wake_up?
Because it complicates the understanding of this code. I spent a lot
of time trying to understand this signal_wake_up().
Perhaps this is just me. But when you see the code which does something,
it is always good to understand the reason, otherwise the code at least
looks wrong.
Or, at least we can add the comment
/*
* there are no reasons for signal_wake_up(), we could
* use wake_up_state() or wake_up_process() instead.
*/
signal_wake_up(child, 1);
Oleg.
next prev parent reply other threads:[~2009-02-09 2:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-08 18:47 [PATCH 2/3] ptrace_untrace: use wake_up_process() instead of bogus signal_wake_up() Oleg Nesterov
2009-02-09 1:38 ` Roland McGrath
2009-02-09 2:42 ` Oleg Nesterov [this message]
2009-02-09 3:42 ` Roland McGrath
2009-02-10 21:35 ` 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=20090209024236.GB28280@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dvlasenk@redhat.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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