Re: [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters

From: Oleg Nesterov

Date: Wed Nov 25 2026 - 13:05:16 EST


On 11/25, Linus Torvalds wrote:
>
> On Wed, 25 Nov 2026 at 03:43, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > On 11/24, Linus Torvalds wrote:
> > >
> > > + if (flags & WQ_FLAG_POLL_EXCLUSIVE)
> > > + poll_woken = nr_exclusive > 0;
> > > + else if ((flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
> > > break;
> >
> > I obviously like this change, but note that wake_up_all*() helpers
> > use nr_exclusive == 0, so
> >
> > poll_woken = nr_exclusive > 0;
> >
> > doesn't look correct.
>
> No, I think it is correct.

It is, sorry for the noise.

> The logic in the new code is that WQ_FLAG_POLL_EXCLUSIVE should only
> wakes up one of the entries that have it, *except* if it's a wake-all.

Yes, yes, this is clear,

> For wake_all, the poll_woken is never triggered.

Yes. I can't explain it, but somehow I thought that that nr_exclusive is
"unsigned". Damn, the only excuse is that I could not really read the code
today ;)

Thanks,

Reviewed-by: Oleg Nesterov <oleg@xxxxxxxxxx>