Re: [PATCH] pipe: keep per-write wakeups for EPOLLEXCLUSIVE consumers
From: Oleg Nesterov
Date: Tue Nov 17 2026 - 15:41:50 EST
On 11/17, Linus Torvalds wrote:
>
> Side note: as part of looking at it, I did look at what it would
> involve in our wait.h infrastructure.
>
> That header isn't _horrible_, but some of it was uglier than needed,
> and adding WQ_FLAG_PRIORITY would have been a huge pain because the
> code unnecessarily special-cases WQ_FLAG_EXCLUSIVE.
>
> So while I threw the rest of my trial patch away, this patch remained
> as a cleanup. It *looks* sane to me, and I think the end result looks
> better and would be more flexible.
>
> For example, it would have allowed just adding a new user of
> ___wait_event() that used WQ_FLAG_PRIORITY to put itself at the head
> of the queue.
...
> -#define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \
> +#define ___wait_event(wq_head, condition, state, wq_flag, ret, cmd) \
> ({ \
> __label__ __out; \
> struct wait_queue_entry __wq_entry; \
> long __ret = ret; /* explicit shadow */ \
> \
> - init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0); \
> + init_wait_entry(&__wq_entry, wq_flag); \
> for (;;) { \
> long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
Damn ;) I simply can't resist.
I swear, I was thinking of exactly that same change during our discussion.
So I think it is obviously good and makes sense, but I will try to re-check
it after sleep.
Oleg.