lkml.org 
[lkml]   [2009]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] ptrace_untrace: use wake_up_process() instead of bogus signal_wake_up()
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.



\
 
 \ /
  Last update: 2009-02-09 03:47    [from the cache]
©2003-2011 Jasper Spaans