From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: sshegde@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, linux-kernel@vger.kernel.org,
ritesh.list@gmail.com, peterz@infradead.org, boqun@kernel.org,
will@kernel.org, jhladky@redhat.com, paulmck@kernel.org
Subject: [RFC 0/3] powerpc64: Preempt count optimizations
Date: Fri, 2 Oct 2026 22:16:16 +0530 [thread overview]
Message-ID: <20261002164619.1455143-1-sshegde@linux.ibm.com> (raw)
This is an RFC and initial implementation of the idea which was discussed
in few threads. [1][2][3]
It is lightly tested, but given changes are involving the core api,
it definitely needs more testing. Also I need to investigate the
patches in more detail and likely changelogs needs update too.
Please go ahead and try to see if works/breaks for you.
Ideas in brief:
1. Move preempt count to PACA.
preempt count in PACA is better as it make it direct access from r13 instead of
obtaining from thread info.
2. Fold need_resched into preempt count.
Also it was noted that adopting similar style of folding need_resched
into preempt count as ARM64 is better as it helps load-store archs and
helps to avoid accessing thread info in fast paths.
3. Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS.
While there enable the HAS_SEPARATE_PREEMPT_RESCHED_BITS which is a
recent trick to fold the NMI bits into preempt count(29-32bits)
instead of using separate per_cpu count.
[1] https://lore.kernel.org/all/e8efdade-161e-4efe-8bd3-abb12ad45dee@linux.ibm.com/
[2] https://lore.kernel.org/all/1eab63fc-b70d-41ef-b720-8ae77d8e56d8@linux.ibm.com/#t
[3] https://lore.kernel.org/all/20260805094219.GM687043@noisy.programming.kicks-ass.net/
Below are hackbench results.
Test Baseline Patched Gain
=============================================================
Hackbench process 10 groups 1.000x 0.991x +0.88%
Hackbench process 20 groups 1.000x 0.972x +2.81%
Hackbench process 30 groups 1.000x 0.976x +2.37%
Hackbench process 40 groups 1.000x 0.979x +2.11%
Hackbench process 50 groups 1.000x 0.980x +2.05%
Hackbench process 60 groups 1.000x 0.982x +1.79%
Hackbench thread 10 groups 1.000x 0.978x +2.23%
Hackbench thread 20 groups 1.000x 0.971x +2.93%
Hackbench process pipe 10 groups 1.000x 0.957x +4.35%
Hackbench process pipe 20 groups 1.000x 0.977x +2.32%
Hackbench process pipe 30 groups 1.000x 0.981x +1.95%
Hackbench process pipe 40 groups 1.000x 0.981x +1.93%
Hackbench process pipe 50 groups 1.000x 0.975x +2.54%
Hackbench process pipe 60 groups 1.000x 1.024x -2.37%
Hackbench thread pipe 10 groups 1.000x 0.970x +3.04%
Hackbench thread pipe 20 groups 1.000x 0.981x +1.89%
Things tested(no warnings/crash):
- Build and boot.
- hackbench run.
- daytrader run.
- kexec.
Shrikanth Hegde (3):
powerpc64: move preempt count to paca
powerpc64/preempt: Add need_resched bit inside preempt_count
powerpc64/Kconfig: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/paca.h | 12 +++
arch/powerpc/include/asm/preempt.h | 113 +++++++++++++++++++++++++
arch/powerpc/include/asm/thread_info.h | 14 ++-
arch/powerpc/kernel/paca.c | 1 +
arch/powerpc/kexec/core_64.c | 2 +-
6 files changed, 139 insertions(+), 4 deletions(-)
create mode 100644 arch/powerpc/include/asm/preempt.h
--
2.52.0
next reply other threads:[~2026-10-02 16:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 16:46 Shrikanth Hegde [this message]
2026-10-02 16:46 ` [RFC 1/3] powerpc64: move preempt count to paca Shrikanth Hegde
2026-10-02 16:46 ` [RFC 2/3] powerpc64/preempt: Add need_resched bit inside preempt_count Shrikanth Hegde
2026-10-02 16:46 ` [RFC 3/3] powerpc64/Kconfig: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITS Shrikanth Hegde
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=20261002164619.1455143-1-sshegde@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=boqun@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jhladky@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=ritesh.list@gmail.com \
--cc=will@kernel.org \
/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®