From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
mt4022@columbia.edu, Jens Axboe <axboe@kernel.dk>,
Ingo Molnar <mingo@redhat.com>,
Christian Brauner <brauner@kernel.org>,
Michal Nazarewicz <mina86@mina86.com>,
Wen Yang <wen.yang@linux.dev>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
tz2294@columbia.edu, stable@vger.kernel.org
Subject: Re: [PATCH 5/7] sched/wait: always queue new waiters at the tail
Date: Thu, 26 Nov 2026 16:48:04 +0100 [thread overview]
Message-ID: <20261126154804.GK49833@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAHk-=wgNZfCN5qW-0pOK_TFBscqTu6an7fK5pEkxewg-Aif1Fg@mail.gmail.com>
On Tue, Nov 24, 2026 at 12:46:30PM -0500, Linus Torvalds wrote:
> 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).
I like this :-)
next prev parent reply other threads:[~2026-11-26 15:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
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-25 23:31 ` Linus Torvalds
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-25 16:36 ` Linus Torvalds
2026-11-25 18:04 ` 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-25 16:39 ` Linus Torvalds
2026-11-25 17:52 ` Linus Torvalds
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-26 15:48 ` Peter Zijlstra [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126154804.GK49833@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mina86@mina86.com \
--cc=mingo@redhat.com \
--cc=mt4022@columbia.edu \
--cc=oleg@redhat.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tz2294@columbia.edu \
--cc=wen.yang@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®