Re: [PATCH] pipe: keep per-write wakeups for EPOLLEXCLUSIVE consumers
From: Linus Torvalds
Date: Wed Nov 18 2026 - 11:01:50 EST
On Wed, 18 Nov 2026 at 05:10, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> What if we add, say, WQ_FLAG_LOCKED and change prepare_to_wait_event()
No, I absolutely detest conditional locking. It *will* cause problems.
Particularly when based on something like this where the locking
depends on not an argument and a call chain, but on a (potentially)
long-lived flag.
> Then we can trivially redefine all users of __wait_event_interruptible_locked()
> on top of ___wait_event/etc.
.. *if* it was passed down as just the argument, I might be open to
it, but honestly, even then it's just nasty. I *much* prefer to have
statically visible locking, and have the pattern of one single helper
that does the core work, and another helper that just does the lock
and then calls the first one.
Some duplication - with explicit naming of the locking status for the
special cases that are called with the lock already held - is much
preferable to dynamically doing the locking (even if the compiler may
be able to then turn it into a static choice at build time, if it's
not obvious from the source code it's still "dynamic")
No locking hacks. Locking - along with memory ordering - is special.
Locking is *not* a flag.
Linus