From: Mitsumasa KONDO <kondo.mitsumasa@gmail.com>
To: andres@anarazel.de
Cc: abuehaze@amazon.de, alisaidi@amazon.com, bigeasy@linutronix.de,
blakgeof@amazon.com, dipietro.salvatore@gmail.com,
dipiets@amazon.it, linux-kernel@vger.kernel.org,
mark.rutland@arm.com, peterz@infradead.org,
ritesh.list@gmail.com, tglx@kernel.org, vschneid@redhat.com,
kondo.mitsumasa@gmail.com
Subject: Re: [PATCH 0/1] sched: Restore PREEMPT_NONE as default
Date: Sun, 5 Apr 2026 23:44:25 +0900 [thread overview]
Message-ID: <20260405144425.36044-1-kondo.mitsumasa@gmail.com> (raw)
In-Reply-To: <20260403191942.21410-1-dipiets@amazon.it>
I believe the root cause is the inadequacy of PostgreSQL's arm64
spin_delay() implementation, which PREEMPT_LAZY merely exposed.
PostgreSQL's SPIN_DELAY() uses dramatically different instructions
per architecture (src/include/storage/s_lock.h):
x86_64: rep; nop (PAUSE, ~140 cycles)
arm64: isb (pipeline flush, ~10-20 cycles)
Under PREEMPT_NONE, lock holders are rarely preempted, so spin
duration is short and ISB's lightweight delay is sufficient.
Under PREEMPT_LAZY, lock holder preemption becomes more frequent.
When this occurs, waiters enter a sustained spin loop. On arm64,
ISB provides negligible delay, so the loop runs at near-full speed,
hammering the lock cacheline via TAS_SPIN's *(lock) load on every
iteration. This generates massive cache coherency traffic that in
turn slows the lock holder's execution after rescheduling, creating
a feedback loop that escalates on high-core-count systems.
On x86_64, PAUSE throttles this loop sufficiently to prevent the
feedback loop, which explains why this is not reproducible there.
Patching PostgreSQL's arm64 spin_delay() to use WFE instead of ISB
should significantly reduce the regression without kernel changes.
That said, this change is likely to cause similar breakage in other
user-space applications beyond PostgreSQL that rely on lightweight
spin loops on arm64. So I agree that the patch to retain PREEMPT_NONE
is the right approach. At the same time, this is also something that
distributions can resolve by patching their default kernel configuration.
Regards,
--
Mitsumasa Kondo
NTT Software Innovation Center
next prev parent reply other threads:[~2026-04-05 14:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 19:19 Salvatore Dipietro
2026-04-03 19:19 ` [PATCH 1/1] " Salvatore Dipietro
2026-04-03 21:32 ` [PATCH 0/1] " Peter Zijlstra
2026-04-04 17:42 ` Andres Freund
2026-04-05 1:40 ` Andres Freund
2026-04-05 4:21 ` Andres Freund
2026-04-05 6:08 ` Ritesh Harjani
2026-04-05 14:09 ` Andres Freund
2026-04-05 14:44 ` Andres Freund
2026-04-07 8:29 ` Peter Zijlstra
2026-04-07 8:27 ` Peter Zijlstra
2026-04-07 10:17 ` David Laight
2026-04-07 8:20 ` Peter Zijlstra
2026-04-07 9:07 ` Peter Zijlstra
2026-04-07 11:19 ` Mark Rutland
2026-04-08 20:08 ` Salvatore Dipietro
2026-04-08 20:51 ` Andres Freund
2026-04-10 15:38 ` Mitsumasa KONDO
2026-04-07 8:49 ` Peter Zijlstra
2026-04-06 0:43 ` Qais Yousef
2026-04-05 14:44 ` Mitsumasa KONDO [this message]
2026-04-05 16:43 ` Andres Freund
2026-04-06 1:46 ` Mitsumasa KONDO
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=20260405144425.36044-1-kondo.mitsumasa@gmail.com \
--to=kondo.mitsumasa@gmail.com \
--cc=abuehaze@amazon.de \
--cc=alisaidi@amazon.com \
--cc=andres@anarazel.de \
--cc=bigeasy@linutronix.de \
--cc=blakgeof@amazon.com \
--cc=dipietro.salvatore@gmail.com \
--cc=dipiets@amazon.it \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=ritesh.list@gmail.com \
--cc=tglx@kernel.org \
--cc=vschneid@redhat.com \
/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®