From: David Laight <david.laight.linux@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Ritesh Harjani <ritesh.list@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Salvatore Dipietro <dipiets@amazon.it>,
linux-kernel@vger.kernel.org, alisaidi@amazon.com,
blakgeof@amazon.com, abuehaze@amazon.de,
dipietro.salvatore@gmail.com, Thomas Gleixner <tglx@kernel.org>,
Valentin Schneider <vschneid@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 0/1] sched: Restore PREEMPT_NONE as default
Date: Tue, 7 Apr 2026 11:17:07 +0100 [thread overview]
Message-ID: <20260407111707.4c4cb7dd@pumpkin> (raw)
In-Reply-To: <4q4zsstjeef63sdkl2az3tziy3etorzzxyt2k4nhwokpmegsr3@y6w76kosjzts>
On Sun, 5 Apr 2026 10:09:35 -0400
Andres Freund <andres@anarazel.de> wrote:
...
> FWIW, from what I can tell, the whole "WHAA, it's a userspace spinlock" part
> has just about nothing to do with the problem. My understanding is that
> default futexes don't transfer the lock waiter's scheduler slice to the lock
> holder (there's no information about who the lock holder is unless it's a PI
> futex), Postgres' spinlock have randomized exponential backoff and the amount
> of spinning is adjusted over time, so you don't actually end up with spinlock
> waiters preventing the lock owner from getting scheduled to a significant
> degree.
Another problem (which also affects futex) is that the lock holder can
get preempted (or just stolen by network interrupts and softint code).
So even if the lock is only held for a few instructions sometimes that can
take several milliseconds.
Pretty much the only way to avoid that is changing the code to be lockless.
(eg changing linked lists to arrays and using atmomic_increment() on a index.)
A much more subtle effect can also affect performance - especially of a
single-threaded cpu-intensive program.
The clock speed of the busy cpu will be boosted (perhaps to 5GHz).
Then a lot of other higher priority processes are all scheduled at the
same time, the cpu-intensive program is preempted.
When the the high priority processes sleep (perhaps almost immediately)
the cpu-intensive program is scheduled on a 'random' cpu that has
been idle so runs at initially (say) 800MHz, before being boosted again.
That effect increased the compile time for an fpga image from ~10 minutes
to ~20 minutes when the renaming of a kernel config option caused one of
the mitigations that significantly slow down system call entry/exit to
slow down an idle daemon than woke threads every 10ms (to process RTP
audio) so that all the threads were active at the same time.
David
>
> Greetings,
>
> Andres Freund
>
next prev parent reply other threads:[~2026-04-07 10:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 19:19 [PATCH 0/1] sched: Restore PREEMPT_NONE as default 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 [this message]
2026-04-07 8:20 ` Peter Zijlstra
2026-04-07 9:07 ` Peter Zijlstra
2026-04-07 11:19 ` Mark Rutland
2026-04-07 8:49 ` Peter Zijlstra
2026-04-06 0:43 ` Qais Yousef
2026-04-05 14:44 ` Mitsumasa KONDO
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=20260407111707.4c4cb7dd@pumpkin \
--to=david.laight.linux@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