mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
@ 2026-11-23  0:35 Mani Tofigh via B4 Relay
  2026-11-23  0:35 ` [PATCH v2 1/2] " Mani Tofigh via B4 Relay
  2026-11-23  0:35 ` [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked() Mani Tofigh via B4 Relay
  0 siblings, 2 replies; 21+ messages in thread
From: Mani Tofigh via B4 Relay @ 2026-11-23  0:35 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Oleg Nesterov, Linus Torvalds, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	stable, Mani Tofigh

Patch 1 is the fix from v1, rebased on top of Linus's commit
cea5f91daa3a ("wait-event: clean up the internal helper arguments").
Patch 2 makes __wait_event_interruptible_locked() take wq_flags like
___wait_event() now does, as Oleg suggested.

Reproducer: https://github.com/manitofigh/files/blob/main/linux-repros/evexcl.c

gpiolib-cdev and cros_ec_chardev use the same helpers and can be
polled too, so this fixes them as well.

---
Changes in v2:
- Rebased on Linus's master, on top of cea5f91daa3a.
- New patch 2: pass wq_flags instead of a 0/1 "exclusive" argument (Oleg).
- Link to v1: https://patch.msgid.link/20261111-b4-sched-wait-intr-head-v1-1-17cf2af5b964@columbia.edu
- Discussion: https://lore.kernel.org/all/awMhxEuMHULvk8SA@redhat.com/

---
Mani Tofigh (2):
      sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
      sched/wait: Pass wq_flags to __wait_event_interruptible_locked()

 include/linux/wait.h | 11 ++++++-----
 kernel/sched/wait.c  | 16 ++++++++++++----
 2 files changed, 18 insertions(+), 9 deletions(-)
---
base-commit: 6e4122f0242a3262512ee3e6f2e7e6de0bd5792b
change-id: 20261111-b4-sched-wait-intr-head-c5e8f0b541f4

Best regards,
--  
Mani Tofigh <mt4022@columbia.edu>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-23  0:35 [PATCH v2 0/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*() Mani Tofigh via B4 Relay
@ 2026-11-23  0:35 ` Mani Tofigh via B4 Relay
  2026-11-23 14:28   ` Oleg Nesterov
  2026-11-23 23:52   ` Linus Torvalds
  2026-11-23  0:35 ` [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked() Mani Tofigh via B4 Relay
  1 sibling, 2 replies; 21+ messages in thread
From: Mani Tofigh via B4 Relay @ 2026-11-23  0:35 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Oleg Nesterov, Linus Torvalds, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	stable, Mani Tofigh

From: Mani Tofigh <mt4022@columbia.edu>

A task blocked in read() on an eventfd or timerfd can sleep forever
while the file is readable, if an epoll(EPOLLEXCLUSIVE) watcher of the
same file was added before it.

eventfd and timerfd wait with wait_event_interruptible_locked_irq().
do_wait_intr_irq() adds the reader at the tail, behind the exclusive
epoll entry, and __wake_up_common() stops after waking that entry.  If
the woken epoll task is killed or leaves without reading, nothing wakes
the reader:

  Task E                   Task A                 Task C
  epoll_wait(ep, -1)
    /* EPOLLEXCLUSIVE */
                           read(efd)
                             /* queued after E */
                                                  write(efd, 1)
                                                    /* wakes E, stops */
                                                  kill(E, SIGKILL)
                           /* still asleep, efd is readable */

A periodic timerfd doesn't wake A either, since the timer is restarted
only by a read.

prepare_to_wait_event() and add_wait_queue() add non-exclusive waiters
at the head, which is what __wake_up_common() relies on.  eventfd did
the same itself before it switched to these helpers.

Do the same in do_wait_intr() and do_wait_intr_irq().  This only changes
the order in which non-exclusive waiters are woken.  Each of them still
gets every wakeup.  With the fix, A is woken by the write.

Fixes: 22c43c81a51e ("wait_event_interruptible_locked() interface")
Cc: stable@vger.kernel.org
Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
---
 kernel/sched/wait.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index f8d6d8b9d03e..342dec5fd937 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -319,8 +319,12 @@ EXPORT_SYMBOL(prepare_to_wait_event);
  */
 int do_wait_intr(wait_queue_head_t *wq, wait_queue_entry_t *wait)
 {
-	if (likely(list_empty(&wait->entry)))
-		__add_wait_queue_entry_tail(wq, wait);
+	if (likely(list_empty(&wait->entry))) {
+		if (wait->flags & WQ_FLAG_EXCLUSIVE)
+			__add_wait_queue_entry_tail(wq, wait);
+		else
+			__add_wait_queue(wq, wait);
+	}
 
 	set_current_state(TASK_INTERRUPTIBLE);
 	if (signal_pending(current))
@@ -336,8 +340,12 @@ EXPORT_SYMBOL(do_wait_intr);
 
 int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_entry_t *wait)
 {
-	if (likely(list_empty(&wait->entry)))
-		__add_wait_queue_entry_tail(wq, wait);
+	if (likely(list_empty(&wait->entry))) {
+		if (wait->flags & WQ_FLAG_EXCLUSIVE)
+			__add_wait_queue_entry_tail(wq, wait);
+		else
+			__add_wait_queue(wq, wait);
+	}
 
 	set_current_state(TASK_INTERRUPTIBLE);
 	if (signal_pending(current))

-- 
2.53.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked()
  2026-11-23  0:35 [PATCH v2 0/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*() Mani Tofigh via B4 Relay
  2026-11-23  0:35 ` [PATCH v2 1/2] " Mani Tofigh via B4 Relay
@ 2026-11-23  0:35 ` Mani Tofigh via B4 Relay
  2026-11-23 14:35   ` Oleg Nesterov
  1 sibling, 1 reply; 21+ messages in thread
From: Mani Tofigh via B4 Relay @ 2026-11-23  0:35 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Oleg Nesterov, Linus Torvalds, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	Mani Tofigh

From: Mani Tofigh <mt4022@columbia.edu>

Commit cea5f91daa3a ("wait-event: clean up the internal helper
arguments") made ___wait_event() take the wait entry's flags instead of
a 0/1 argument for whether it is exclusive.
__wait_event_interruptible_locked() still takes the 0/1 argument.

Pass wq_flags here too, so the _exclusive_locked variants say
WQ_FLAG_EXCLUSIVE rather than an unexplained 1.

No functional change.

Signed-off-by: Mani Tofigh <mt4022@columbia.edu>
---
 include/linux/wait.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index b3e94c71cd3e..6c039d92c770 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -770,12 +770,11 @@ do {										\
 extern int do_wait_intr(wait_queue_head_t *, wait_queue_entry_t *);
 extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
 
-#define __wait_event_interruptible_locked(wq, condition, exclusive, fn)		\
+#define __wait_event_interruptible_locked(wq, condition, wq_flags, fn)		\
 ({										\
 	int __ret;								\
 	DEFINE_WAIT(__wait);							\
-	if (exclusive)								\
-		__wait.flags |= WQ_FLAG_EXCLUSIVE;				\
+	__wait.flags = (wq_flags);						\
 	do {									\
 		__ret = fn(&(wq), &__wait);					\
 		if (__ret)							\
@@ -870,7 +869,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
  */
 #define wait_event_interruptible_exclusive_locked(wq, condition)		\
 	((condition)								\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition,			\
+						 WQ_FLAG_EXCLUSIVE, do_wait_intr))
 
 /**
  * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
@@ -901,7 +901,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
  */
 #define wait_event_interruptible_exclusive_locked_irq(wq, condition)		\
 	((condition)								\
-	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
+	 ? 0 : __wait_event_interruptible_locked(wq, condition,			\
+						 WQ_FLAG_EXCLUSIVE, do_wait_intr_irq))
 
 
 #define __wait_event_killable(wq, condition)					\

-- 
2.53.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-23  0:35 ` [PATCH v2 1/2] " Mani Tofigh via B4 Relay
@ 2026-11-23 14:28   ` Oleg Nesterov
  2026-11-23 23:52   ` Linus Torvalds
  1 sibling, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-23 14:28 UTC (permalink / raw)
  To: Mani Tofigh via B4 Relay
  Cc: Peter Zijlstra, Ingo Molnar, Linus Torvalds, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	stable, Mani Tofigh

On 11/22, Mani Tofigh via B4 Relay wrote:
>
> --- a/kernel/sched/wait.c
> +++ b/kernel/sched/wait.c
> @@ -319,8 +319,12 @@ EXPORT_SYMBOL(prepare_to_wait_event);
>   */
>  int do_wait_intr(wait_queue_head_t *wq, wait_queue_entry_t *wait)
>  {
> -	if (likely(list_empty(&wait->entry)))
> -		__add_wait_queue_entry_tail(wq, wait);
> +	if (likely(list_empty(&wait->entry))) {
> +		if (wait->flags & WQ_FLAG_EXCLUSIVE)
> +			__add_wait_queue_entry_tail(wq, wait);
> +		else
> +			__add_wait_queue(wq, wait);
> +	}
>  
>  	set_current_state(TASK_INTERRUPTIBLE);
>  	if (signal_pending(current))
> @@ -336,8 +340,12 @@ EXPORT_SYMBOL(do_wait_intr);
>  
>  int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_entry_t *wait)
>  {
> -	if (likely(list_empty(&wait->entry)))
> -		__add_wait_queue_entry_tail(wq, wait);
> +	if (likely(list_empty(&wait->entry))) {
> +		if (wait->flags & WQ_FLAG_EXCLUSIVE)
> +			__add_wait_queue_entry_tail(wq, wait);
> +		else
> +			__add_wait_queue(wq, wait);
> +	}
>  
>  	set_current_state(TASK_INTERRUPTIBLE);
>  	if (signal_pending(current))

perhaps it makes sense to add the new trivial helper later,
prepare_to_wait_event() can use it too.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked()
  2026-11-23  0:35 ` [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked() Mani Tofigh via B4 Relay
@ 2026-11-23 14:35   ` Oleg Nesterov
  0 siblings, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-23 14:35 UTC (permalink / raw)
  To: Mani Tofigh via B4 Relay
  Cc: Peter Zijlstra, Ingo Molnar, Linus Torvalds, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	Mani Tofigh

On 11/22, Mani Tofigh via B4 Relay wrote:
>
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -770,12 +770,11 @@ do {										\
>  extern int do_wait_intr(wait_queue_head_t *, wait_queue_entry_t *);
>  extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
>  
> -#define __wait_event_interruptible_locked(wq, condition, exclusive, fn)		\
> +#define __wait_event_interruptible_locked(wq, condition, wq_flags, fn)		\
>  ({										\
>  	int __ret;								\
>  	DEFINE_WAIT(__wait);							\
> -	if (exclusive)								\
> -		__wait.flags |= WQ_FLAG_EXCLUSIVE;				\
> +	__wait.flags = (wq_flags);						\
>  	do {									\
>  		__ret = fn(&(wq), &__wait);					\
>  		if (__ret)							\
> @@ -870,7 +869,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
>   */
>  #define wait_event_interruptible_exclusive_locked(wq, condition)		\
>  	((condition)								\
> -	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
> +	 ? 0 : __wait_event_interruptible_locked(wq, condition,			\
> +						 WQ_FLAG_EXCLUSIVE, do_wait_intr))
>  
>  /**
>   * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
> @@ -901,7 +901,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
>   */
>  #define wait_event_interruptible_exclusive_locked_irq(wq, condition)		\
>  	((condition)								\
> -	 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
> +	 ? 0 : __wait_event_interruptible_locked(wq, condition,			\
> +						 WQ_FLAG_EXCLUSIVE, do_wait_intr_irq))

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-23  0:35 ` [PATCH v2 1/2] " Mani Tofigh via B4 Relay
  2026-11-23 14:28   ` Oleg Nesterov
@ 2026-11-23 23:52   ` Linus Torvalds
  2026-11-24 11:54     ` Oleg Nesterov
  2026-11-24 13:36     ` Oleg Nesterov
  1 sibling, 2 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-23 23:52 UTC (permalink / raw)
  To: mt4022, Jens Axboe
  Cc: Peter Zijlstra, Ingo Molnar, Oleg Nesterov, Christian Brauner,
	Michal Nazarewicz, Wen Yang, linux-fsdevel, linux-kernel, tz2294,
	stable

On Sun, 22 Nov 2026 at 16:35, Mani Tofigh via B4 Relay
<devnull+mt4022.columbia.edu@kernel.org> wrote:
>
> A task blocked in read() on an eventfd or timerfd can sleep forever
> while the file is readable, if an epoll(EPOLLEXCLUSIVE) watcher of the
> same file was added before it.

Honestly, I don't think this is the right approach.

We need to fix the disaster area that is epoll, rather than work around
more epoll bugs elsewhere and make other places more fragile and
complex.

I think we should stop playing games with wait-queue ordering entirely.

The problem WQ_EXCLUSIVE tries to fix is the thundering herd issue, and
I think we could afford to just always walk the whole wait-queue list -
just not wake up multiple exclusive waiters.

The wait-queue traversal itself was never the problem, and stopping
early was a premature optimization that causes these kinds of problems.

For example, right now that ordering means not only that we have that
subtle __add_wait_queue_entry_tail() vs __add_wait_queue() thing - we
also have that disgusting WQ_FLAG_PRIORITY thing.

I think the (single) user of add_wait_queue_priority_exclusive() should
just walk the queue itself, and not mess up the global wait queue logic
with its braindamage.

It's literally just kvm eventfd that is being special - and it's the "my
mom told me I'm special" kind of special, not the "it's really important
and fundamental" kind of special.

The whole hypervisor WQ_FLAG_EXCLUSIVE | WQ_FLAG_PRIORITY games should
be removed from the core entirely and the those eventfd things should
move to their own helpers that nobody else needs to care about.

And I think we should always add new waiters to the end of the queue,
and stop any other games. Just walk the whole queue at wakeup time.

Finally, I think we should make the return value from the wakeup
function be a bitmask, and count "exclusive" as only "we haven't seen
this bit returned yet". And then *real* exclusive users that actually
guarantee that they react to the wakeup return all bits set, but the
sh*t-for-brains garbage that is "epoll" only returns its own bit set -
so we only wake up *one* epoll user, but we wake up other users anyway,
because epoll clearl yis lying about its "exclusivity".

Because trying to fix the mess that epoll has caused is not worth it. We
need to just accept the fact that epoll is garbage, but we also need to
fundamentally make that garbage not mess with the rest of the kernel.

Anyway, because I wanted to see who plays games with the wake-up
function, and because that thing is horribly named ('func' - not exactly
unambiguous), I did the attached patch. It makes it a bit more obvious
who actually uses anything but the normal wakeup functions.

It incidentally also made it obvious that very few people knew about out
'init_wait_func()' helper. We had a couple of users. But we had more
users that did

        init_wait(wait);
        wait->func = im_so_special_wake_fn;

by hand instead. And memcontrol-v1 - that everybody loves - didn't do
even that, but seemed to write things out by hand entirely.

And the i915 driver did its own thing entirely and re-implemented the
whole wakeup side. Christ. nilfss is doing something odd too.

No, this patch has not been tested. It seems to compile, at least on
x86-64 allmodconfig.

Comments? Would anybody be willing to do a deep dive into the whole
wakeup situation? I'd also love to make the wakeup functions return void
instead of the number of things woken - because of that whole "exclusive
would be better off not entirely exclusive" issue, but it looks like the
sbitmap code actually uses it. Nobody else seems to.

Added Jens because he's the sbitmap person.

               Linus

--- untested patch just because I couldn't tell who played games ---

 drivers/gpu/drm/i915/display/intel_display_rps.c |  2 +-
 drivers/gpu/drm/i915/i915_active.c               |  2 +-
 drivers/gpu/drm/i915/i915_sw_fence.c             | 10 +++++-----
 drivers/gpu/drm/radeon/radeon_fence.c            |  2 +-
 fs/dax.c                                         |  9 +++------
 fs/eventpoll.c                                   |  3 +--
 fs/gfs2/glock.c                                  |  3 +--
 fs/nfs/nfs4proc.c                                |  3 +--
 fs/nilfs2/segment.c                              |  2 +-
 include/linux/sbitmap.h                          |  2 +-
 include/linux/wait.h                             | 12 ++++++------
 include/linux/wait_bit.h                         |  2 +-
 io_uring/io-wq.c                                 |  2 +-
 io_uring/rw.c                                    |  2 +-
 kernel/sched/wait.c                              |  4 ++--
 kernel/sched/wait_bit.c                          |  8 ++++----
 mm/filemap.c                                     |  6 ++----
 mm/memcontrol-v1.c                               |  5 +----
 18 files changed, 34 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_rps.c
b/drivers/gpu/drm/i915/display/intel_display_rps.c
index 2f8248458826..fa707a144d5b 100644
--- a/drivers/gpu/drm/i915/display/intel_display_rps.c
+++ b/drivers/gpu/drm/i915/display/intel_display_rps.c
@@ -68,7 +68,7 @@ void intel_display_rps_boost_after_vblank(struct
drm_crtc *crtc,
 	wait->fence = dma_fence_get(fence);
 	wait->crtc = crtc;

-	wait->wait.func = do_rps_boost;
+	wait->wait.wake_up_fn = do_rps_boost;
 	wait->wait.flags = 0;

 	add_wait_queue(drm_crtc_vblank_waitqueue(crtc), &wait->wait);
diff --git a/drivers/gpu/drm/i915/i915_active.c
b/drivers/gpu/drm/i915/i915_active.c
index b2442f05825e..1c207ddab5ba 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -666,7 +666,7 @@ static int __await_barrier(struct i915_active
*ref, struct i915_sw_fence *fence)
 	}

 	wb->base.flags = 0;
-	wb->base.func = barrier_wake;
+	wb->base.wake_up_fn = barrier_wake;
 	wb->base.private = fence;
 	wb->ref = ref;

diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c
b/drivers/gpu/drm/i915/i915_sw_fence.c
index f24f616e23ee..156a65f009eb 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence.c
@@ -161,7 +161,7 @@ static void __i915_sw_fence_wake_up_all(struct
i915_sw_fence *fence,
 			if (pos->flags & I915_SW_FENCE_FLAG_FENCE)
 				list_move_tail(&pos->entry, continuation);
 			else
-				pos->func(pos, TASK_NORMAL, 0, continuation);
+				pos->wake_up_fn(pos, TASK_NORMAL, 0, continuation);
 		}
 	} else {
 		LIST_HEAD(extra);
@@ -174,7 +174,7 @@ static void __i915_sw_fence_wake_up_all(struct
i915_sw_fence *fence,
 				if (pos->flags & I915_SW_FENCE_FLAG_FENCE)
 					wake_flags = fence->error;

-				pos->func(pos, TASK_NORMAL, wake_flags, &extra);
+				pos->wake_up_fn(pos, TASK_NORMAL, wake_flags, &extra);
 			}

 			if (list_empty(&extra))
@@ -291,7 +291,7 @@ static bool __i915_sw_fence_check_if_after(struct
i915_sw_fence *fence,
 		return true;

 	list_for_each_entry(wq, &fence->wait.head, entry) {
-		if (wq->func != i915_sw_fence_wake)
+		if (wq->wake_up_fn != i915_sw_fence_wake)
 			continue;

 		if (__i915_sw_fence_check_if_after(wq->private, signaler))
@@ -309,7 +309,7 @@ static void
__i915_sw_fence_clear_checked_bit(struct i915_sw_fence *fence)
 		return;

 	list_for_each_entry(wq, &fence->wait.head, entry) {
-		if (wq->func != i915_sw_fence_wake)
+		if (wq->wake_up_fn != i915_sw_fence_wake)
 			continue;

 		__i915_sw_fence_clear_checked_bit(wq->private);
@@ -375,7 +375,7 @@ static int __i915_sw_fence_await_sw_fence(struct
i915_sw_fence *fence,

 	INIT_LIST_HEAD(&wq->entry);
 	wq->flags = pending;
-	wq->func = i915_sw_fence_wake;
+	wq->wake_up_fn = i915_sw_fence_wake;
 	wq->private = fence;

 	i915_sw_fence_await(fence);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c
b/drivers/gpu/drm/radeon/radeon_fence.c
index 8e9402b8811b..d254278d0cb5 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -409,7 +409,7 @@ static bool radeon_fence_enable_signaling(struct
dma_fence *f)

 	fence->fence_wake.flags = 0;
 	fence->fence_wake.private = NULL;
-	fence->fence_wake.func = radeon_fence_check_signaled;
+	fence->fence_wake.wake_up_fn = radeon_fence_check_signaled;
 	__add_wait_queue(&rdev->fence_queue, &fence->fence_wake);
 	dma_fence_get(f);
 	return true;
diff --git a/fs/dax.c b/fs/dax.c
index 9d161d7ef3ef..4e8cad4dcb95 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -215,8 +215,7 @@ static void *get_next_unlocked_entry(struct
xa_state *xas, unsigned int order)
 	struct wait_exceptional_entry_queue ewait;
 	wait_queue_head_t *wq;

-	init_wait(&ewait.wait);
-	ewait.wait.func = wake_exceptional_entry_func;
+	init_wait_func(&ewait.wait, wake_exceptional_entry_func);

 	for (;;) {
 		entry = xas_find_conflict(xas);
@@ -248,8 +247,7 @@ static void *wait_entry_unlocked_exclusive(struct
xa_state *xas, void *entry)
 	struct wait_exceptional_entry_queue ewait;
 	wait_queue_head_t *wq;

-	init_wait(&ewait.wait);
-	ewait.wait.func = wake_exceptional_entry_func;
+	init_wait_func(&ewait.wait, wake_exceptional_entry_func);

 	while (unlikely(dax_is_locked(entry))) {
 		wq = dax_entry_waitqueue(xas, entry, &ewait.key);
@@ -279,8 +277,7 @@ static void wait_entry_unlocked(struct xa_state
*xas, void *entry)
 	struct wait_exceptional_entry_queue ewait;
 	wait_queue_head_t *wq;

-	init_wait(&ewait.wait);
-	ewait.wait.func = wake_exceptional_entry_func;
+	init_wait_func(&ewait.wait, wake_exceptional_entry_func);

 	wq = dax_entry_waitqueue(xas, entry, &ewait.key);
 	/*
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b959af04772c..0e13477f8be5 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2333,8 +2333,7 @@ static int ep_poll(struct eventpoll *ep, struct
epoll_event __user *events,
 		 * performance issue if a process is killed, causing all of its
 		 * threads to wake up without being removed normally.
 		 */
-		init_wait(&wait);
-		wait.func = ep_autoremove_wake_function;
+		init_wait_func(&wait, ep_autoremove_wake_function);

 		spin_lock_irq(&ep->lock);
 		/*
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index d22a088c66cd..cd3ad3cb91a8 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1009,8 +1009,7 @@ static struct gfs2_glock
*find_insert_glock(struct lm_lockname *name,
 	struct gfs2_glock *gl;

 	wait.name = name;
-	init_wait(&wait.wait);
-	wait.wait.func = glock_wake_function;
+	init_wait_func(&wait.wait, glock_wake_function);

 again:
 	prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6759fa61b9b4..d817d12249da 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7757,8 +7757,7 @@ nfs4_retry_setlk(struct nfs4_state *state, int
cmd, struct file_lock *request)
 	if (!test_bit(NFS_STATE_MAY_NOTIFY_LOCK, &state->flags))
 		return nfs4_retry_setlk_simple(state, cmd, request);

-	init_wait(&waiter.wait);
-	waiter.wait.func = nfs4_wake_lock_waiter;
+	init_wait_func(&waiter.wait, nfs4_wake_lock_waiter);
 	add_wait_queue(q, &waiter.wait);

 	do {
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index af0c3560444f..ec14365762c2 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2297,7 +2297,7 @@ static void nilfs_segctor_wakeup(struct
nilfs_sc_info *sci, int err, bool force)
 			atomic_set(&wrq->done, 1);
 		}
 		if (atomic_read(&wrq->done)) {
-			wrq->wq.func(&wrq->wq,
+			wrq->wq.wake_up_fn(&wrq->wq,
 				     TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
 				     0, NULL);
 		}
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h
index cc7ad189caa5..6317a60d8df2 100644
--- a/include/linux/sbitmap.h
+++ b/include/linux/sbitmap.h
@@ -595,7 +595,7 @@ struct sbq_wait {
 		.sbq = NULL,							\
 		.wait = {							\
 			.private	= current,				\
-			.func		= autoremove_wake_function,		\
+			.wake_up_fn	= autoremove_wake_function,		\
 			.entry		= LIST_HEAD_INIT((name).wait.entry),	\
 		}								\
 	}
diff --git a/include/linux/wait.h b/include/linux/wait.h
index b3e94c71cd3e..0252fc690b26 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -28,7 +28,7 @@ int default_wake_function(struct wait_queue_entry
*wq_entry, unsigned mode, int
 struct wait_queue_entry {
 	unsigned int		flags;
 	void			*private;
-	wait_queue_func_t	func;
+	wait_queue_func_t	wake_up_fn;
 	struct list_head	entry;
 };

@@ -46,7 +46,7 @@ struct task_struct;

 #define __WAITQUEUE_INITIALIZER(name, tsk) {					\
 	.private	= tsk,							\
-	.func		= default_wake_function,				\
+	.wake_up_fn	= default_wake_function,				\
 	.entry		= { NULL, NULL } }

 #define DECLARE_WAITQUEUE(name, tsk)						\
@@ -81,7 +81,7 @@ static inline void init_waitqueue_entry(struct
wait_queue_entry *wq_entry, struc
 {
 	wq_entry->flags		= 0;
 	wq_entry->private	= p;
-	wq_entry->func		= default_wake_function;
+	wq_entry->wake_up_fn	= default_wake_function;
 }

 static inline void
@@ -89,7 +89,7 @@ init_waitqueue_func_entry(struct wait_queue_entry
*wq_entry, wait_queue_func_t f
 {
 	wq_entry->flags		= 0;
 	wq_entry->private	= NULL;
-	wq_entry->func		= func;
+	wq_entry->wake_up_fn	= func;
 }

 /**
@@ -1228,7 +1228,7 @@ int autoremove_wake_function(struct
wait_queue_entry *wq_entry, unsigned mode, i
 #define DEFINE_WAIT_FUNC(name, function)					\
 	struct wait_queue_entry name = {					\
 		.private	= current,					\
-		.func		= function,					\
+		.wake_up_fn	= function,					\
 		.entry		= LIST_HEAD_INIT((name).entry),			\
 	}

@@ -1237,7 +1237,7 @@ int autoremove_wake_function(struct
wait_queue_entry *wq_entry, unsigned mode, i
 #define init_wait_func(wait, function)						\
 	do {									\
 		(wait)->private = current;					\
-		(wait)->func = function;					\
+		(wait)->wake_up_fn = function;					\
 		INIT_LIST_HEAD(&(wait)->entry);					\
 		(wait)->flags = 0;						\
 	} while (0)
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index af077ed4caf6..0bec1e7ea485 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -41,7 +41,7 @@ int wake_bit_function(struct wait_queue_entry
*wq_entry, unsigned mode, int sync
 		.key = __WAIT_BIT_KEY_INITIALIZER(word, bit),			\
 		.wq_entry = {							\
 			.private	= current,				\
-			.func		= wake_bit_function,			\
+			.wake_up_fn	= wake_bit_function,			\
 			.entry		=					\
 				LIST_HEAD_INIT((name).wq_entry.entry),		\
 		},								\
diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index 9609ae50dbd7..faf159d37026 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -1409,7 +1409,7 @@ struct io_wq *io_wq_create(unsigned bounded,
struct io_wq_data *data)
 	wq->acct[IO_WQ_ACCT_UNBOUND].max_workers =
 				task_rlimit(current, RLIMIT_NPROC);
 	INIT_LIST_HEAD(&wq->wait.entry);
-	wq->wait.func = io_wq_hash_wake;
+	wq->wait.wake_up_fn = io_wq_hash_wake;
 	for (i = 0; i < IO_WQ_ACCT_NR; i++) {
 		struct io_wq_acct *acct = &wq->acct[i];

diff --git a/io_uring/rw.c b/io_uring/rw.c
index cf20597ba6a8..3e29bf8a1e57 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -804,7 +804,7 @@ static bool io_rw_should_retry(struct io_kiocb *req)
 	    !(req->file->f_op->fop_flags & FOP_BUFFER_RASYNC))
 		return false;

-	wait->wait.func = io_async_buf_func;
+	wait->wait.wake_up_fn = io_async_buf_func;
 	wait->wait.private = req;
 	wait->wait.flags = 0;
 	INIT_LIST_HEAD(&wait->wait.entry);
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index f8d6d8b9d03e..5339faf2c84d 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -105,7 +105,7 @@ static int __wake_up_common(struct wait_queue_head
*wq_head, unsigned int mode,
 		unsigned flags = curr->flags;
 		int ret;

-		ret = curr->func(curr, mode, wake_flags, key);
+		ret = curr->wake_up_fn(curr, mode, wake_flags, key);
 		if (ret < 0)
 			break;
 		if (ret && (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
@@ -269,7 +269,7 @@ void init_wait_entry(struct wait_queue_entry
*wq_entry, int flags)
 {
 	wq_entry->flags = flags;
 	wq_entry->private = current;
-	wq_entry->func = autoremove_wake_function;
+	wq_entry->wake_up_fn = autoremove_wake_function;
 	INIT_LIST_HEAD(&wq_entry->entry);
 }
 EXPORT_SYMBOL(init_wait_entry);
diff --git a/kernel/sched/wait_bit.c b/kernel/sched/wait_bit.c
index 348f7211b4aa..2936887fad6f 100644
--- a/kernel/sched/wait_bit.c
+++ b/kernel/sched/wait_bit.c
@@ -198,10 +198,10 @@ void init_wait_var_entry(struct
wait_bit_queue_entry *wbq_entry, void *var, int
 			.bit_nr = -1,
 		},
 		.wq_entry = {
-			.flags	 = flags,
-			.private = current,
-			.func	 = var_wake_function,
-			.entry	 = LIST_HEAD_INIT(wbq_entry->wq_entry.entry),
+			.flags	    = flags,
+			.private    = current,
+			.wake_up_fn = var_wake_function,
+			.entry	    = LIST_HEAD_INIT(wbq_entry->wq_entry.entry),
 		},
 	};
 }
diff --git a/mm/filemap.c b/mm/filemap.c
index a1b2ca5b933c..931de8fedc36 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1263,8 +1263,7 @@ static inline int folio_wait_bit_common(struct
folio *folio, int bit_nr,
 		thrashing = true;
 	}

-	init_wait(wait);
-	wait->func = wake_page_function;
+	init_wait_func(wait, wake_page_function);
 	wait_page.folio = folio;
 	wait_page.bit_nr = bit_nr;

@@ -1430,8 +1429,7 @@ void softleaf_entry_wait_on_locked(softleaf_t
entry, spinlock_t *ptl)
 		thrashing = true;
 	}

-	init_wait(wait);
-	wait->func = wake_page_function;
+	init_wait_func(wait, wake_page_function);
 	wait_page.folio = folio;
 	wait_page.bit_nr = PG_locked;
 	wait->flags = 0;
diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index b7f286888507..cc5c64cbdfff 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -1053,10 +1053,7 @@ bool mem_cgroup_oom_synchronize(bool handle)
 		goto cleanup;

 	owait.memcg = memcg;
-	owait.wait.flags = 0;
-	owait.wait.func = memcg_oom_wake_function;
-	owait.wait.private = current;
-	INIT_LIST_HEAD(&owait.wait.entry);
+	init_wait_func(&owait.wait, memcg_oom_wake_function);

 	prepare_to_wait(&memcg_oom_waitq, &owait.wait, TASK_KILLABLE);
 	mem_cgroup_mark_under_oom(memcg);

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-23 23:52   ` Linus Torvalds
@ 2026-11-24 11:54     ` Oleg Nesterov
  2026-11-24 13:36     ` Oleg Nesterov
  1 sibling, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-24 11:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

[-- Attachment #1: Type: text/plain, Size: 2595 bytes --]

On 11/23, Linus Torvalds wrote:
>
> On Sun, 22 Nov 2026 at 16:35, Mani Tofigh via B4 Relay
> <devnull+mt4022.columbia.edu@kernel.org> wrote:
> >
> > A task blocked in read() on an eventfd or timerfd can sleep forever
> > while the file is readable, if an epoll(EPOLLEXCLUSIVE) watcher of the
> > same file was added before it.
>
> Honestly, I don't think this is the right approach.
>
> We need to fix the disaster area that is epoll, rather than work around
> more epoll bugs elsewhere and make other places more fragile and
> complex.

I agree. But to me it would be better to apply this patch from Mani,
then do something else. Not because it "fixes" the scenario described
in the changelog. As for eventfd_read(), it probably makes sense to
change it to use wait_event_interruptible_exclusive_locked_irq() at
least if !EFD_SEMAPHORE, and then we will have the same problem with
EPOLLEXCLUSIVE again.

But simply because do_wait_intr*() are wrong regardless, and the
change is trivial. And perhaps the changelog should not mention
EPOLLEXCLUSIVE at all.

> And I think we should always add new waiters to the end of the queue,
> and stop any other games. Just walk the whole queue at wakeup time.
>
> Finally, I think we should make the return value from the wakeup
> function be a bitmask, and count "exclusive" as only "we haven't seen
> this bit returned yet". And then *real* exclusive users that actually
> guarantee that they react to the wakeup return all bits set, but the
> sh*t-for-brains garbage that is "epoll" only returns its own bit set -
> so we only wake up *one* epoll user, but we wake up other users anyway,
> because epoll clearl yis lying about its "exclusivity".

Perhaps... But it is not clear how to do this gradually...

And lets forget about epoll for the moment. Lets suppose we change
__wake_up_common() to do

	list_for_each_entry_safe(curr, next, &wq_head->head, entry) {
		bool excl = curr->flags & WQ_FLAG_EXCLUSIVE;
		int ret;

		if (excl && !nr_exclusive)
			continue;
		ret = curr->func(curr, mode, wake_flags, key);
		if (ret < 0)
			break;
		if (ret && excl)
			--nr_exclusive;
	}

This will change the current behaviour if ret < 0. Say wake_page_function() does

	if (flags & WQ_FLAG_EXCLUSIVE) {
		if (test_bit(key->bit_nr, &key->folio->flags.f))
			return -1;
		...

so this logic depends on wait-queue ordering too. "ret < 0" can be encoded
in the bitmask, but it is not clear what exactly __wake_up_common() needs
to do in this case.

Can't we at least cleanup __wake_up_common() ? See the patch below, I already
sent it but it was ignored.

Oleg.


[-- Attachment #2: 0001-sched-wait-kill-leftover-bookmark-logic-in-__wake_up.patch --]
[-- Type: text/plain, Size: 1289 bytes --]

From 887e7597e23b1beb5c6ed536cb342a2daa740ce5 Mon Sep 17 00:00:00 2001
From: Oleg Nesterov <oleg@redhat.com>
Date: Thu, 12 Nov 2026 15:53:53 +0100
Subject: [PATCH] sched/wait: kill leftover bookmark logic in
 __wake_up_common()

The manual list head check and list_for_each_entry_safe_from() in
__wake_up_common() are leftovers from commit 2554db916586 ("sched/wait:
Break up long wake list walk").

This logic was later removed by commit 37acade0ce89 ("sched: remove
wait bookmarks") but the now-unnecessary list hacks were left behind.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/sched/wait.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index f8d6d8b9d03e..d0521b54eeb3 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -96,12 +96,7 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
 
 	lockdep_assert_held(&wq_head->lock);
 
-	curr = list_first_entry(&wq_head->head, wait_queue_entry_t, entry);
-
-	if (&curr->entry == &wq_head->head)
-		return nr_exclusive;
-
-	list_for_each_entry_safe_from(curr, next, &wq_head->head, entry) {
+	list_for_each_entry_safe(curr, next, &wq_head->head, entry) {
 		unsigned flags = curr->flags;
 		int ret;
 
-- 
2.55.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-23 23:52   ` Linus Torvalds
  2026-11-24 11:54     ` Oleg Nesterov
@ 2026-11-24 13:36     ` Oleg Nesterov
  2026-11-24 16:38       ` Linus Torvalds
  1 sibling, 1 reply; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-24 13:36 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On 11/23, Linus Torvalds wrote:
>
> Finally, I think we should make the return value from the wakeup
> function be a bitmask, and count "exclusive" as only "we haven't seen
> this bit returned yet". And then *real* exclusive users that actually
> guarantee that they react to the wakeup return all bits set, but the
> sh*t-for-brains garbage that is "epoll" only returns its own bit set -
> so we only wake up *one* epoll user, but we wake up other users anyway,
> because epoll clearl yis lying about its "exclusivity".

Ah, I don't think this can work... Suppose that ep_poll_callback()
returns its own EP_XXX bit set. Should __wake_up_common() wake up
the next waiter? It can't know until it calls ->wake_up_fn() which
can wakeup another epoll waiter.

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

	static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
				int nr_exclusive, int wake_flags, void *key)
	{
		wait_queue_entry_t *curr, *next;
		bool seen_epoll = false;

		lockdep_assert_held(&wq_head->lock);

		list_for_each_entry_safe(curr, next, &wq_head->head, entry) {
			unsigned flags = curr->flags;
			int ret;

			if ((flags & WQ_FLAG_EPOLLEXCLUSIVE) && seen_epoll)
				continue;

			ret = curr->func(curr, mode, wake_flags, key);
			if (ret < 0)
				break;
			if (ret && (flags & WQ_FLAG_EXCLUSIVE)) {
				if (flags & WQ_FLAG_EPOLLEXCLUSIVE)
					seen_epoll = true;
				else if (!--nr_exclusive)
					break;
			}
		}

		return nr_exclusive;
	}

for the start.

Oleg.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-24 13:36     ` Oleg Nesterov
@ 2026-11-24 16:38       ` Linus Torvalds
  2026-11-24 17:41         ` Linus Torvalds
  0 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 16:38 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On Tue, 24 Nov 2026 at 05:36, Oleg Nesterov <oleg@redhat.com> 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.

                 Linus

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*()
  2026-11-24 16:38       ` Linus Torvalds
@ 2026-11-24 17:41         ` Linus Torvalds
  2026-11-24 17:43           ` [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups Linus Torvalds
                             ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:41 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On Tue, 24 Nov 2026 at 08:38, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Tue, 24 Nov 2026 at 05:36, Oleg Nesterov <oleg@redhat.com> 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups
  2026-11-24 17:41         ` Linus Torvalds
@ 2026-11-24 17:43           ` Linus Torvalds
  2026-11-24 17:44           ` [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters Linus Torvalds
                             ` (5 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:43 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 17:33:14 -0800
Subject: [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups

sctp_wait_for_packet() waits exclusively on sk_sleep() with the default
autoremove wake function, so it accepts any wakeup and consumes it.

Then __sctp_write_space() sends EPOLLOUT with a wake-one wakeup:
sctp_wait_for_packet() wakes up, finds no data, goes back to sleep, and
the walk stops.

End result: anybody else queued behind it that was waiting for EPOLLOUT
will never see it.

Filter on EPOLLIN | EPOLLERR like receiver_wake_function() in
net/core/datagram.c.  State changes (using sock_def_wakeup()) use an
unkeyed wake-all and still get through and will ignore the exclusive
nature of sctp_wait_for_packet().

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: Eric Dumazet <edumazet@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 net/sctp/socket.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index bc68af88e271..85ac4952e9cb 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -9070,6 +9070,15 @@ static int sctp_msghdr_parse(const struct
msghdr *msg, struct sctp_cmsgs *cmsgs)
 	return 0;
 }

+/* Don't take wakeups for other events, e.g. EPOLLOUT from write space. */
+static int sctp_receiver_wake_function(wait_queue_entry_t *wait,
+				       unsigned int mode, int sync, void *key)
+{
+	if (key && !(key_to_poll(key) & (EPOLLIN | EPOLLERR)))
+		return 0;
+	return autoremove_wake_function(wait, mode, sync, key);
+}
+
 /*
  * Wait for a packet..
  * Note: This function is the same function as in core/datagram.c
@@ -9078,7 +9087,7 @@ static int sctp_msghdr_parse(const struct msghdr
*msg, struct sctp_cmsgs *cmsgs)
 static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p)
 {
 	int error;
-	DEFINE_WAIT(wait);
+	DEFINE_WAIT_FUNC(wait, sctp_receiver_wake_function);

 	prepare_to_wait_exclusive(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);

-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters
  2026-11-24 17:41         ` Linus Torvalds
  2026-11-24 17:43           ` [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups Linus Torvalds
@ 2026-11-24 17:44           ` Linus Torvalds
  2026-11-25 11:43             ` Oleg Nesterov
  2026-11-24 17:44           ` [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE Linus Torvalds
                             ` (4 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:44 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 16:47:33 -0800
Subject: [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space
 waiters

An exclusive waiter whose wake function returns a positive return value
to indicate that it has successfully been woken up stops the wakeup
walk, on the understanding that it will handle the event.

However, user space consumers - like eventpoll or io_uring - want to be
woken up, and want to avoid the thundering herd issue.  So they used an
exclusive wait - but without any actual guarantee that they will then
meaningfully handle the event.

So the wakeup could be lost, and real waiters would be left pending.

Add a separate flag for these kind of "exclusive poll" cases, which is
effectively what these user space waiters are.  Only the first such
entry that accepts a wakeup is woken, as now, but they don't count
against nr_exclusive and it doesn't stop the walk.

Wake-all (nr_exclusive == 0, including POLLFREE) still calls every entry.

Reported-by: Mani Tofigh <mt4022@columbia.edu>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 include/linux/wait.h |  1 +
 kernel/sched/wait.c  | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index b3e94c71cd3e..09518f8ff10c 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -21,6 +21,7 @@ int default_wake_function(struct wait_queue_entry
*wq_entry, unsigned mode, int
 #define WQ_FLAG_CUSTOM		0x04
 #define WQ_FLAG_DONE		0x08
 #define WQ_FLAG_PRIORITY	0x10
+#define WQ_FLAG_POLL_EXCLUSIVE	0x20

 /*
  * A single wait-queue entry structure:
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index f8d6d8b9d03e..9f126cc5c338 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -85,6 +85,11 @@ EXPORT_SYMBOL(remove_wait_queue);
  * may be at the head of the list, and can consume the event without any other
  * tasks being woken if it's also an exclusive task.
  *
+ * An exclusive waiter that returns >0 promises to handle the event. Pollers
+ * (EPOLLEXCLUSIVE) can't promise that, since userspace may never consume it.
+ * They use WQ_FLAG_POLL_EXCLUSIVE instead: only one of them is woken, but they
+ * never count against nr_exclusive or stop the walk.
+ *
  * There are circumstances in which we can try to wake a task which has already
  * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
@@ -93,6 +98,7 @@ static int __wake_up_common(struct wait_queue_head
*wq_head, unsigned int mode,
 			int nr_exclusive, int wake_flags, void *key)
 {
 	wait_queue_entry_t *curr, *next;
+	bool poll_woken = false;

 	lockdep_assert_held(&wq_head->lock);

@@ -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;
 	}

-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE
  2026-11-24 17:41         ` Linus Torvalds
  2026-11-24 17:43           ` [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups Linus Torvalds
  2026-11-24 17:44           ` [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters Linus Torvalds
@ 2026-11-24 17:44           ` Linus Torvalds
  2026-11-25 11:55             ` Oleg Nesterov
  2026-11-24 17:45           ` [PATCH 4/7] io_uring/poll: " Linus Torvalds
                             ` (3 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:44 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 16:47:42 -0800
Subject: [PATCH 3/7] eventpoll: don't claim real exclusivity for
 EPOLLEXCLUSIVE

An EPOLLEXCLUSIVE entry that wakes an epoll_wait()er returns 1, and
because it was queued as an exclusive waiter that stops the wakeup walk.

But nothing makes the epoll user consume the event: it may be killed,
time out, pick another ready fd, or just not read.  Anything queued
behind the entry - a blocked pipe reader, an accept()er, a recv()er -
then sleeps with the event pending.

Queue it with WQ_FLAG_POLL_EXCLUSIVE instead: still only one epoll
instance is woken per wakeup, but real waiters are not skipped.

Reported-by: Mani Tofigh <mt4022@columbia.edu>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/eventpoll.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b959af04772c..58c0cb845dc7 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1626,9 +1626,8 @@ static void ep_ptable_queue_proc(struct file
*file, wait_queue_head_t *whead,
 	pwq->whead = whead;
 	pwq->base = epi;
 	if (epi->event.events & EPOLLEXCLUSIVE)
-		add_wait_queue_exclusive(whead, &pwq->wait);
-	else
-		add_wait_queue(whead, &pwq->wait);
+		pwq->wait.flags |= WQ_FLAG_POLL_EXCLUSIVE;
+	add_wait_queue(whead, &pwq->wait);
 	pwq->next = epi->pwqlist;
 	epi->pwqlist = pwq;
 }
-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 4/7] io_uring/poll: don't claim real exclusivity for EPOLLEXCLUSIVE
  2026-11-24 17:41         ` Linus Torvalds
                             ` (2 preceding siblings ...)
  2026-11-24 17:44           ` [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE Linus Torvalds
@ 2026-11-24 17:45           ` Linus Torvalds
  2026-11-24 17:46           ` [PATCH 5/7] sched/wait: always queue new waiters at the tail Linus Torvalds
                             ` (2 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:45 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 16:47:49 -0800
Subject: [PATCH 4/7] io_uring/poll: don't claim real exclusivity for
 EPOLLEXCLUSIVE

Same problem as epoll: an EPOLLEXCLUSIVE poll request returns 1 from
io_poll_wake() (even when it lost the ownership race and does nothing),
which stops the wakeup walk, but posting a CQE doesn't consume the
event.

Waiters queued behind it can sleep with the event pending.

Use WQ_FLAG_POLL_EXCLUSIVE, so only one io_uring entry is woken but real
waiters are not skipped.

Reported-by: Mani Tofigh <mt4022@columbia.edu>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 io_uring/poll.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/io_uring/poll.c b/io_uring/poll.c
index fc1800c7097b..67bf39575238 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -533,11 +533,9 @@ static void __io_queue_proc(struct io_poll *poll,
struct io_poll_table *pt,
 	poll->head = head;
 	poll->wait.private = (void *) wqe_private;

-	if (poll->events & EPOLLEXCLUSIVE) {
-		add_wait_queue_exclusive(head, &poll->wait);
-	} else {
-		add_wait_queue(head, &poll->wait);
-	}
+	if (poll->events & EPOLLEXCLUSIVE)
+		poll->wait.flags |= WQ_FLAG_POLL_EXCLUSIVE;
+	add_wait_queue(head, &poll->wait);
 }

 static void io_poll_queue_proc(struct file *file, struct wait_queue_head *head,
-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 5/7] sched/wait: always queue new waiters at the tail
  2026-11-24 17:41         ` Linus Torvalds
                             ` (3 preceding siblings ...)
  2026-11-24 17:45           ` [PATCH 4/7] io_uring/poll: " Linus Torvalds
@ 2026-11-24 17:46           ` Linus Torvalds
  2026-11-25 12:24             ` Oleg Nesterov
  2026-11-24 17:47           ` [PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail() Linus Torvalds
  2026-11-24 17:47           ` [PATCH 7/7] sched/wait: remove the __add_wait_queue_*exclusive() helpers Linus Torvalds
  6 siblings, 1 reply; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:46 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 16:48:44 -0800
Subject: [PATCH 5/7] sched/wait: always queue new waiters at the tail

Non-exclusive waiters have been added at the head and exclusive ones at
the tail, so that an exclusive wakeup stopping early still woke every
non-exclusive waiter.

That only matters for waiters that mix both kinds on one queue like
read() and poll() on a pipe - and even then it doesn't actually buy
anything but complexity and fragility of the code.

An exclusive reader consumes the event, the poller had nothing to see,
so there's no real point in keeping the two ordered.

The pointless ordering results in a special rule for everybody adding
themselves to the wait queue, and that rule has not been consistently
followed anyway (see for example do_wait_intr() and do_wait_intr_irq())

So just queue everyone in FIFO order.  LIFO might be better for
throughput, but every time we've ever tried that optimization in real
life, it has caused fairness issues, so let's just do the obvious thing
and add new waiters at the end of the list.

Priority entries (used by the hypervisor code - questionable special
case) are still placed at the head by add_wait_queue_priority*().

And because epoll is a pile of stinking manure that I am afraid to touch
this leaves __add_wait_queue_exclusive() alone and it adds its entry at
the head for epoll's ep->wq so its own wakeup order doesn't change.

Now that it isn't a "real" exclusive wake event, its ordering thankfully
doesn't actually matter for anybody else.  It should be fixed, but it's
now basically just an internal epoll thing (and that will be made more
obvious in following patches).

Cc: Christian Brauner <brauner@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 include/linux/wait.h | 14 +++-----------
 kernel/sched/wait.c  | 29 ++++++++++++++++-------------
 2 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 09518f8ff10c..bf0a3713ed0f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -171,25 +171,17 @@ extern void remove_wait_queue(struct
wait_queue_head *wq_head, struct wait_queue

 static inline void __add_wait_queue(struct wait_queue_head *wq_head,
struct wait_queue_entry *wq_entry)
 {
-	struct list_head *head = &wq_head->head;
-	struct wait_queue_entry *wq;
-
-	list_for_each_entry(wq, &wq_head->head, entry) {
-		if (!(wq->flags & WQ_FLAG_PRIORITY))
-			break;
-		head = &wq->entry;
-	}
-	list_add(&wq_entry->entry, head);
+	list_add_tail(&wq_entry->entry, &wq_head->head);
 }

 /*
- * Used for wake-one threads:
+ * Adds at the head, for epoll's LIFO wakeup of its epoll_wait()ers.
  */
 static inline void
 __add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct
wait_queue_entry *wq_entry)
 {
 	wq_entry->flags |= WQ_FLAG_EXCLUSIVE;
-	__add_wait_queue(wq_head, wq_entry);
+	list_add(&wq_entry->entry, &wq_head->head);
 }

 static inline void __add_wait_queue_entry_tail(struct wait_queue_head
*wq_head, struct wait_queue_entry *wq_entry)
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 9f126cc5c338..a14e14202279 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -40,11 +40,18 @@ EXPORT_SYMBOL(add_wait_queue_exclusive);

 void add_wait_queue_priority(struct wait_queue_head *wq_head, struct
wait_queue_entry *wq_entry)
 {
+	struct list_head *head = &wq_head->head;
+	struct wait_queue_entry *wq;
 	unsigned long flags;

 	wq_entry->flags |= WQ_FLAG_PRIORITY;
 	spin_lock_irqsave(&wq_head->lock, flags);
-	__add_wait_queue(wq_head, wq_entry);
+	list_for_each_entry(wq, &wq_head->head, entry) {
+		if (!(wq->flags & WQ_FLAG_PRIORITY))
+			break;
+		head = &wq->entry;
+	}
+	list_add(&wq_entry->entry, head);
 	spin_unlock_irqrestore(&wq_head->lock, flags);
 }
 EXPORT_SYMBOL_GPL(add_wait_queue_priority);
@@ -78,12 +85,12 @@ EXPORT_SYMBOL(remove_wait_queue);

 /*
  * The core wakeup function. Non-exclusive wakeups (nr_exclusive == 0) just
- * wake everything up. If it's an exclusive wakeup (nr_exclusive == small +ve
- * number) then we wake that number of exclusive tasks, and potentially all
- * the non-exclusive tasks. Normally, exclusive tasks will be at the end of
- * the list and any non-exclusive tasks will be woken first. A priority task
- * may be at the head of the list, and can consume the event without any other
- * tasks being woken if it's also an exclusive task.
+ * wake everything up. Otherwise the walk stops once nr_exclusive exclusive
+ * tasks have been woken. Waiters are queued in FIFO order, so non-exclusive
+ * waiters queued behind that point are not woken: the exclusive waiters will
+ * consume the event. A priority task may be at the head of the list, and can
+ * consume the event without any other tasks being woken if it's also an
+ * exclusive task.
  *
  * An exclusive waiter that returns >0 promises to handle the event. Pollers
  * (EPOLLEXCLUSIVE) can't promise that, since userspace may never consume it.
@@ -308,12 +315,8 @@ long prepare_to_wait_event(struct wait_queue_head
*wq_head, struct wait_queue_en
 		list_del_init(&wq_entry->entry);
 		ret = -ERESTARTSYS;
 	} else {
-		if (list_empty(&wq_entry->entry)) {
-			if (wq_entry->flags & WQ_FLAG_EXCLUSIVE)
-				__add_wait_queue_entry_tail(wq_head, wq_entry);
-			else
-				__add_wait_queue(wq_head, wq_entry);
-		}
+		if (list_empty(&wq_entry->entry))
+			__add_wait_queue(wq_head, wq_entry);
 		set_current_state(state);
 	}
 	spin_unlock_irqrestore(&wq_head->lock, flags);
-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail()
  2026-11-24 17:41         ` Linus Torvalds
                             ` (4 preceding siblings ...)
  2026-11-24 17:46           ` [PATCH 5/7] sched/wait: always queue new waiters at the tail Linus Torvalds
@ 2026-11-24 17:47           ` Linus Torvalds
  2026-11-24 17:47           ` [PATCH 7/7] sched/wait: remove the __add_wait_queue_*exclusive() helpers Linus Torvalds
  6 siblings, 0 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:47 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 16:56:58 -0800
Subject: [PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail()

__add_wait_queue() and __add_wait_queue_entry_tail() are now the same.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 block/blk-iocost.c                   | 2 +-
 drivers/gpu/drm/i915/i915_sw_fence.c | 2 +-
 fs/orangefs/orangefs-bufmap.c        | 2 +-
 include/linux/wait.h                 | 7 +------
 kernel/locking/percpu-rwsem.c        | 2 +-
 kernel/sched/wait.c                  | 8 ++++----
 mm/filemap.c                         | 6 +++---
 7 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 0ffe34bd95b7..f435bb894d71 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2764,7 +2764,7 @@ iocg_handle_over_budget(struct rq_qos *rqos,
struct ioc_gq *iocg,
 	wait->abs_cost = abs_cost;
 	wait->committed = false; /* will be set true by waker */

-	__add_wait_queue_entry_tail(&iocg->waitq, &wait->wait);
+	__add_wait_queue(&iocg->waitq, &wait->wait);
 	iocg_kick_waitq(iocg, ioc_locked, now);
 	return action_wait;
 }
diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c
b/drivers/gpu/drm/i915/i915_sw_fence.c
index f24f616e23ee..e107ba9d4c24 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence.c
@@ -382,7 +382,7 @@ static int __i915_sw_fence_await_sw_fence(struct
i915_sw_fence *fence,

 	spin_lock_irqsave(&signaler->wait.lock, flags);
 	if (likely(!i915_sw_fence_done(signaler))) {
-		__add_wait_queue_entry_tail(&signaler->wait, wq);
+		__add_wait_queue(&signaler->wait, wq);
 		pending = 1;
 	} else {
 		i915_sw_fence_wake(wq, 0, signaler->error, NULL);
diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index a557e1cf7436..34195f2cd845 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -48,7 +48,7 @@ static void run_down(struct slot_map *m)
 	if (m->c != -1) {
 		for (;;) {
 			if (likely(list_empty(&wait.entry)))
-				__add_wait_queue_entry_tail(&m->q, &wait);
+				__add_wait_queue(&m->q, &wait);
 			set_current_state(TASK_UNINTERRUPTIBLE);

 			if (m->c == -1)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index bf0a3713ed0f..4f87ad870f51 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -184,16 +184,11 @@ __add_wait_queue_exclusive(struct
wait_queue_head *wq_head, struct wait_queue_en
 	list_add(&wq_entry->entry, &wq_head->head);
 }

-static inline void __add_wait_queue_entry_tail(struct wait_queue_head
*wq_head, struct wait_queue_entry *wq_entry)
-{
-	list_add_tail(&wq_entry->entry, &wq_head->head);
-}
-
 static inline void
 __add_wait_queue_entry_tail_exclusive(struct wait_queue_head
*wq_head, struct wait_queue_entry *wq_entry)
 {
 	wq_entry->flags |= WQ_FLAG_EXCLUSIVE;
-	__add_wait_queue_entry_tail(wq_head, wq_entry);
+	__add_wait_queue(wq_head, wq_entry);
 }

 static inline void
diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c
index 6c78961fe753..0e1b6e3210a2 100644
--- a/kernel/locking/percpu-rwsem.c
+++ b/kernel/locking/percpu-rwsem.c
@@ -152,7 +152,7 @@ static void percpu_rwsem_wait(struct
percpu_rw_semaphore *sem, bool reader,
 	wait = !__percpu_rwsem_trylock(sem, reader);
 	if (wait) {
 		wq_entry.flags |= WQ_FLAG_EXCLUSIVE | reader * WQ_FLAG_CUSTOM;
-		__add_wait_queue_entry_tail(&sem->waiters, &wq_entry);
+		__add_wait_queue(&sem->waiters, &wq_entry);
 	}
 	spin_unlock_irq(&sem->waiters.lock);

diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index a14e14202279..c77f104ae2fb 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -33,7 +33,7 @@ void add_wait_queue_exclusive(struct wait_queue_head
*wq_head, struct wait_queue

 	wq_entry->flags |= WQ_FLAG_EXCLUSIVE;
 	spin_lock_irqsave(&wq_head->lock, flags);
-	__add_wait_queue_entry_tail(wq_head, wq_entry);
+	__add_wait_queue(wq_head, wq_entry);
 	spin_unlock_irqrestore(&wq_head->lock, flags);
 }
 EXPORT_SYMBOL(add_wait_queue_exclusive);
@@ -276,7 +276,7 @@ prepare_to_wait_exclusive(struct wait_queue_head
*wq_head, struct wait_queue_ent
 	spin_lock_irqsave(&wq_head->lock, flags);
 	if (list_empty(&wq_entry->entry)) {
 		was_empty = list_empty(&wq_head->head);
-		__add_wait_queue_entry_tail(wq_head, wq_entry);
+		__add_wait_queue(wq_head, wq_entry);
 	}
 	set_current_state(state);
 	spin_unlock_irqrestore(&wq_head->lock, flags);
@@ -335,7 +335,7 @@ EXPORT_SYMBOL(prepare_to_wait_event);
 int do_wait_intr(wait_queue_head_t *wq, wait_queue_entry_t *wait)
 {
 	if (likely(list_empty(&wait->entry)))
-		__add_wait_queue_entry_tail(wq, wait);
+		__add_wait_queue(wq, wait);

 	set_current_state(TASK_INTERRUPTIBLE);
 	if (signal_pending(current))
@@ -352,7 +352,7 @@ EXPORT_SYMBOL(do_wait_intr);
 int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_entry_t *wait)
 {
 	if (likely(list_empty(&wait->entry)))
-		__add_wait_queue_entry_tail(wq, wait);
+		__add_wait_queue(wq, wait);

 	set_current_state(TASK_INTERRUPTIBLE);
 	if (signal_pending(current))
diff --git a/mm/filemap.c b/mm/filemap.c
index a1b2ca5b933c..126f5b9849f4 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1293,7 +1293,7 @@ static inline int folio_wait_bit_common(struct
folio *folio, int bit_nr,
 	spin_lock_irq(&q->lock);
 	folio_set_waiters(folio);
 	if (!folio_trylock_flag(folio, bit_nr, wait))
-		__add_wait_queue_entry_tail(q, wait);
+		__add_wait_queue(q, wait);
 	spin_unlock_irq(&q->lock);

 	/*
@@ -1439,7 +1439,7 @@ void softleaf_entry_wait_on_locked(softleaf_t
entry, spinlock_t *ptl)
 	spin_lock_irq(&q->lock);
 	folio_set_waiters(folio);
 	if (!folio_trylock_flag(folio, PG_locked, wait))
-		__add_wait_queue_entry_tail(q, wait);
+		__add_wait_queue(q, wait);
 	spin_unlock_irq(&q->lock);

 	/*
@@ -1757,7 +1757,7 @@ static int __folio_lock_async(struct folio
*folio, struct wait_page_queue *wait)
 	wait->bit_nr = PG_locked;

 	spin_lock_irq(&q->lock);
-	__add_wait_queue_entry_tail(q, &wait->wait);
+	__add_wait_queue(q, &wait->wait);
 	folio_set_waiters(folio);
 	ret = !folio_trylock(folio);
 	/*
-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 7/7] sched/wait: remove the __add_wait_queue_*exclusive() helpers
  2026-11-24 17:41         ` Linus Torvalds
                             ` (5 preceding siblings ...)
  2026-11-24 17:47           ` [PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail() Linus Torvalds
@ 2026-11-24 17:47           ` Linus Torvalds
  6 siblings, 0 replies; 21+ messages in thread
From: Linus Torvalds @ 2026-11-24 17:47 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 23 Nov 2026 17:04:33 -0800
Subject: [PATCH 7/7] sched/wait: remove the __add_wait_queue_*exclusive()
 helpers

Each has one or two special-case users.  Open-code them there: set
WQ_FLAG_EXCLUSIVE and queue the entry directly, with a note on why the
caller doesn't use add_wait_queue_exclusive().

I think all cases (eventpoll, orangefs and ubifs) are unnecessary and
could just use the regular ordering, but I'll leave that to those
maintainers to sort out.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>	# eventpoll
Cc: Christian Brauner <brauner@kernel.org>	# eventpoll
Cc: Jan Kara <jack@suse.cz>			# eventpoll
Cc: Mike Marshall <hubcap@omnibond.com>		# orangefs
Cc: Richard Weinberger <richard@nod.at>		# ubifs
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/eventpoll.c                |  7 +++++--
 fs/orangefs/orangefs-bufmap.c |  7 +++++--
 fs/ubifs/journal.c            |  4 +++-
 include/linux/wait.h          | 17 -----------------
 4 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 58c0cb845dc7..14095cd5f7cf 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -2351,8 +2351,11 @@ static int ep_poll(struct eventpoll *ep, struct
epoll_event __user *events,
 		 * important.
 		 */
 		eavail = ep_events_available(ep);
-		if (!eavail)
-			__add_wait_queue_exclusive(&ep->wq, &wait);
+		if (!eavail) {
+			/* Head, for LIFO wakeups; ep->lock serializes ep->wq */
+			wait.flags |= WQ_FLAG_EXCLUSIVE;
+			list_add(&wait.entry, &ep->wq.head);
+		}

 		spin_unlock_irq(&ep->lock);

diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c
index 34195f2cd845..bc0abc050934 100644
--- a/fs/orangefs/orangefs-bufmap.c
+++ b/fs/orangefs/orangefs-bufmap.c
@@ -85,8 +85,11 @@ static int wait_for_free(struct slot_map *m)

 	do {
 		long n = left, t;
-		if (likely(list_empty(&wait.entry)))
-			__add_wait_queue_entry_tail_exclusive(&m->q, &wait);
+		if (likely(list_empty(&wait.entry))) {
+			/* m->q.lock is held */
+			wait.flags |= WQ_FLAG_EXCLUSIVE;
+			__add_wait_queue(&m->q, &wait);
+		}
 		set_current_state(TASK_INTERRUPTIBLE);

 		if (m->c > 0)
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 40a95a2fad50..a8a6c9b01b9b 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -303,7 +303,9 @@ static void __queue_and_wait(struct ubifs_info *c)
 {
 	DEFINE_WAIT(wait);

-	__add_wait_queue_entry_tail_exclusive(&c->reserve_space_wq, &wait);
+	/* c->reserve_space_wq.lock is held */
+	wait.flags |= WQ_FLAG_EXCLUSIVE;
+	__add_wait_queue(&c->reserve_space_wq, &wait);
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	spin_unlock(&c->reserve_space_wq.lock);

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 4f87ad870f51..bc2ad10a00b2 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -174,23 +174,6 @@ static inline void __add_wait_queue(struct
wait_queue_head *wq_head, struct wait
 	list_add_tail(&wq_entry->entry, &wq_head->head);
 }

-/*
- * Adds at the head, for epoll's LIFO wakeup of its epoll_wait()ers.
- */
-static inline void
-__add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct
wait_queue_entry *wq_entry)
-{
-	wq_entry->flags |= WQ_FLAG_EXCLUSIVE;
-	list_add(&wq_entry->entry, &wq_head->head);
-}
-
-static inline void
-__add_wait_queue_entry_tail_exclusive(struct wait_queue_head
*wq_head, struct wait_queue_entry *wq_entry)
-{
-	wq_entry->flags |= WQ_FLAG_EXCLUSIVE;
-	__add_wait_queue(wq_head, wq_entry);
-}
-
 static inline void
 __remove_wait_queue(struct wait_queue_head *wq_head, struct
wait_queue_entry *wq_entry)
 {
-- 
2.56.0.313.g975a75ca90

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters
  2026-11-24 17:44           ` [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters Linus Torvalds
@ 2026-11-25 11:43             ` Oleg Nesterov
  2026-11-25 12:15               ` Oleg Nesterov
  0 siblings, 1 reply; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-25 11:43 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

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.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE
  2026-11-24 17:44           ` [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE Linus Torvalds
@ 2026-11-25 11:55             ` Oleg Nesterov
  0 siblings, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-25 11:55 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On 11/24, Linus Torvalds wrote:
>
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1626,9 +1626,8 @@ static void ep_ptable_queue_proc(struct file
> *file, wait_queue_head_t *whead,

FYI, none of these patches can be applied, both patch and git-am complain
"patch: **** malformed patch at line 34: *file, wait_queue_head_t *whead,"

>  	pwq->whead = whead;
>  	pwq->base = epi;
>  	if (epi->event.events & EPOLLEXCLUSIVE)
> -		add_wait_queue_exclusive(whead, &pwq->wait);
> -	else
> -		add_wait_queue(whead, &pwq->wait);
> +		pwq->wait.flags |= WQ_FLAG_POLL_EXCLUSIVE;
> +	add_wait_queue(whead, &pwq->wait);

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters
  2026-11-25 11:43             ` Oleg Nesterov
@ 2026-11-25 12:15               ` Oleg Nesterov
  0 siblings, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-25 12:15 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On 11/25, Oleg Nesterov wrote:
>
> 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.

Yes, but ...

> I think this patch should also change them to
> use nr_exclusive = -1.

No, this won't help. It seems that __wake_up_common() needs
"bool all = !nr_exclusive" before the main loop.

Oleg.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/7] sched/wait: always queue new waiters at the tail
  2026-11-24 17:46           ` [PATCH 5/7] sched/wait: always queue new waiters at the tail Linus Torvalds
@ 2026-11-25 12:24             ` Oleg Nesterov
  0 siblings, 0 replies; 21+ messages in thread
From: Oleg Nesterov @ 2026-11-25 12:24 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: mt4022, Jens Axboe, Peter Zijlstra, Ingo Molnar,
	Christian Brauner, Michal Nazarewicz, Wen Yang, linux-fsdevel,
	linux-kernel, tz2294, stable

On 11/24, Linus Torvalds wrote:
>
> So just queue everyone in FIFO order.  LIFO might be better for
> throughput, but every time we've ever tried that optimization in real
> life, it has caused fairness issues, so let's just do the obvious thing
> and add new waiters at the end of the list.

I am still worried about the "ret < 0" case in __wake_up_common().

wake_page_function() does

	if (flags & WQ_FLAG_EXCLUSIVE) {
		if (test_bit(key->bit_nr, &key->folio->flags.f))
			return -1;
		if (flags & WQ_FLAG_CUSTOM) {
			if (test_and_set_bit(key->bit_nr, &key->folio->flags.f))
				return -1;
			flags |= WQ_FLAG_DONE;
		}
	}

Before this patch, all non-exclusive waiters are already woken when
wake_page_function() returns -1.


Perhaps this change in behaviour is fine... I'll try to carefully read
your series later.

Oleg.


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-11-25 12:24 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  0:35 [PATCH v2 0/2] sched/wait: Queue non-exclusive waiters at the head in do_wait_intr*() Mani Tofigh via B4 Relay
2026-11-23  0:35 ` [PATCH v2 1/2] " Mani Tofigh via B4 Relay
2026-11-23 14:28   ` Oleg Nesterov
2026-11-23 23:52   ` Linus Torvalds
2026-11-24 11:54     ` Oleg Nesterov
2026-11-24 13:36     ` Oleg Nesterov
2026-11-24 16:38       ` Linus Torvalds
2026-11-24 17:41         ` Linus Torvalds
2026-11-24 17:43           ` [PATCH 1/7] sctp: don't let a blocked reader take write-space wakeups Linus Torvalds
2026-11-24 17:44           ` [PATCH 2/7] sched/wait: add WQ_FLAG_POLL_EXCLUSIVE for user space waiters Linus Torvalds
2026-11-25 11:43             ` Oleg Nesterov
2026-11-25 12:15               ` Oleg Nesterov
2026-11-24 17:44           ` [PATCH 3/7] eventpoll: don't claim real exclusivity for EPOLLEXCLUSIVE Linus Torvalds
2026-11-25 11:55             ` Oleg Nesterov
2026-11-24 17:45           ` [PATCH 4/7] io_uring/poll: " Linus Torvalds
2026-11-24 17:46           ` [PATCH 5/7] sched/wait: always queue new waiters at the tail Linus Torvalds
2026-11-25 12:24             ` Oleg Nesterov
2026-11-24 17:47           ` [PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail() Linus Torvalds
2026-11-24 17:47           ` [PATCH 7/7] sched/wait: remove the __add_wait_queue_*exclusive() helpers Linus Torvalds
2026-11-23  0:35 ` [PATCH v2 2/2] sched/wait: Pass wq_flags to __wait_event_interruptible_locked() Mani Tofigh via B4 Relay
2026-11-23 14:35   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®