Messages in this thread | | | Date | Thu, 22 Oct 2015 15:38:24 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 14/23] userfaultfd: wake pending userfaults |
| |
On Thu, Oct 22, 2015 at 03:20:15PM +0200, Andrea Arcangeli wrote:
> If schedule spontaneously wakes up a task in TASK_KILLABLE state that > would be a bug in the scheduler in my view. Luckily there doesn't seem > to be such a bug, or at least we never experienced it.
Well, there will be a wakeup, just not the one you were hoping for.
We have code that does:
@cond = true; get_task_struct(p); queue(p)
/* random wait somewhere */ for (;;) { prepare_to_wait(); if (@cond) break;
...
handle_userfault() ... schedule(); ...
dequeue(p) wake_up_process(p) ---> wakeup without userfault wakeup
These races are (extremely) rare, but they do exist. Therefore one must never assume schedule() will not spuriously wake because of these things.
Also, see:
lkml.kernel.org/r/CA+55aFwHkOo+YGWKYROmce1-H_uG3KfEUmCkJUerTj=ojY2H6Q@mail.gmail.com
| |