[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/23] userfaultfd: wake pending userfaults
From: |
Peter Zijlstra |
Subject: |
Re: [Qemu-devel] [PATCH 14/23] userfaultfd: wake pending userfaults |
Date: |
Thu, 22 Oct 2015 15:38:24 +0200 |
User-agent: |
Mutt/1.5.21 (2012-12-30) |
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/address@hidden