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

From: Oleg Nesterov

Date: Wed Nov 25 2026 - 06:43:46 EST


On 11/24, Linus Torvalds wrote:
>
> @@ -105,10 +111,16 @@ static int __wake_up_common(struct
> wait_queue_head *wq_head, unsigned int mode,
> unsigned flags = curr->flags;
> int ret;
>
> + if ((flags & WQ_FLAG_POLL_EXCLUSIVE) && poll_woken)
> + continue;
> ret = curr->func(curr, mode, wake_flags, key);
> if (ret < 0)
> break;
> - if (ret && (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
> + if (!ret)
> + continue;
> + 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. I think this patch should also change them to
use nr_exclusive = -1.

Oleg.