Re: [RFC PATCH] sched/wait: Make interruptible exclusive waitqueue wakeups reliable

From: Linus Torvalds
Date: Mon Dec 09 2019 - 13:07:21 EST


On Mon, Dec 9, 2019 at 2:28 AM Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> Totally untested, but shows the principle: I believe interrupted
> exclusive waits should not auto-cleanup in prepare_to_wait_event().

Oleg convinced me I was wrong, and that there is no bug, so I don't
think we need anything after all.

Yes, there's a "race" between wakeup and returning the error, but
since any correct code already relies on the condition having become
true before the wakeup (and it needs to be a stable condition -
otherwise the exclusive waiters wouldn't work in the first place), the
code that returns the error will never get reached because of the

> if (condition)
> break;

part of the ___wait_event() macro.

Linus