Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
From: Linus Torvalds
Date: Tue Nov 24 2026 - 12:41:49 EST
On Tue, 24 Nov 2026 at 08:38, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, 24 Nov 2026 at 05:36, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > Well. It is not that I like this idea (and I bet neither you ;) but
> > we can add WQ_FLAG_EPOLLEXCLUSIVE set by ep_ptable_queue_proc() and
> > __io_queue_proc(), and change __wake_up_common() to check it
>
> Yes. I called it WQ_FLAG_POLL_EXCLUSIVE. Let me send out a series
> after I've cleaned it up a bit.
Ok, let's see if this works. It's been "tested" in the sense that I'm
running a kernel with these in place right now, and it all *looks*
obvious and builds clean both on allmodconfig and on my local kernel
config.
I'll send out the seven patches as replies to this email, but for
people who prefer git, it's also in my repo as
'review/wait-tail-only'.
It doesn't *really* add all waiters to the tail like that branch names
implies, but it's a big step in that direction.
Please comment and review. The shortlog and total diffstat both look
very reasonable to me (but I'm obviously biased):
sctp: don't let a blocked reader take write-space wakeups
sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters
eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE
io_uring/poll: don't claim real exclusivity for EPOLLEXCLUSIVE
sched/wait: always queue new waiters at the tail
sched/wait: remove __add_wait_queue_entry_tail()
sched/wait: remove the __add_wait_queue_*exclusive() helpers
block/blk-iocost.c | 2 +-
drivers/gpu/drm/i915/i915_sw_fence.c | 2 +-
fs/eventpoll.c | 12 +++++----
fs/orangefs/orangefs-bufmap.c | 9 ++++---
fs/ubifs/journal.c | 4 ++-
include/linux/wait.h | 31 +---------------------
io_uring/poll.c | 8 +++---
kernel/locking/percpu-rwsem.c | 2 +-
kernel/sched/wait.c | 51 +++++++++++++++++++++++-------------
mm/filemap.c | 6 ++---
net/sctp/socket.c | 11 +++++++-
11 files changed, 69 insertions(+), 69 deletions(-)
and the core changes actually remove more lines than they add even if
the end result is a wash at equal number of lines added and deleted.
That net/sctp/socket.c thing really looks like a real bug-fix to me,
for example.
I dropped my rename patch because it's big and would distract from
this all, but I think it would be healthy to do eventually regardless.
NOTE! I obviously did *not* test the epoll or io_uring side, but I
really think those changes are also very real bug-fixes and the
current situation is just bad.
So I'd honestly rather do this series for back-porting than add even
more complexity to the waitqueues - and not even fix the fundamental
bugs.
But hey - feel free to tell me otherwise. Jens - I'd like you in
particular to look at the trivial io_uring changes - epoll can go DIAF
as far as I'm concerned, but io_uring really did have the same bug and
I guess we should care more.
Linus