Re: [PATCH] sched: remove false-positive warning from wake_up_process()

From: Linus Torvalds
Date: Mon Nov 30 2015 - 22:14:50 EST


On Mon, Nov 30, 2015 at 6:48 PM, Rik van Riel <riel@xxxxxxxxxx> wrote:
>
> What would the correct behaviour in that case be?
>
> Does waking up the task while it is being traced, and ptrace
> (or gdb) is not expecting a wakeup, break the tracing?

It would.

We already do the right thing (thanks to that commit 9067ac85d533),
namely just ignore the spurious wakeup.

Basically, all "normal" wait events have to be in a loop around the
event condition because of spurious wakeups like this, and they
already are (ie helpers like "wait_event()" etc do the right thing,
and in general it's actually fairly hard to do the wrong thing).

And special things like TASK_STOPPED now only get woken up by properly
serialized things that are supposed to wake them up.

So we're ok. It's just that the sanity check WARN_ON() was racily too
eager to warn about mis-use. The warning was *meant* to trigger in
case somebody depended on the old broken behavior of
"wake_up_process() wakes up anything" that the code moved away from.
But the warning also triggered for this race condition, that was
actually fixed by the commit in question.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/