[PATCH 6/7] sched/wait: remove __add_wait_queue_entry_tail()

From: Linus Torvalds

Date: Tue Nov 24 2026 - 12:47:21 EST


From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
---
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