Skip to content

RFC powerpc64: Preempt count optimizations

Shrikanth Hegde linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3powerpc64: move preempt count to pacaarch/powerpc/include/asm/paca.h arch/powerpc/include/asm/preempt.h arch/powerpc/include/asm/thread_info.h +2 more+117 -40 replies
2/3powerpc64/preempt: Add need_resched bit inside preempt_countarch/powerpc/include/asm/paca.h arch/powerpc/include/asm/preempt.h arch/powerpc/kexec/core_64.c+44 -230 replies
3/3powerpc64/Kconfig: Enable HAS_SEPARATE_PREEMPT_RESCHED_BITSarch/powerpc/Kconfig+1 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/3] powerpc64: Preempt count optimizations

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/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/#t
[3] https://lore.kernel.org/all/[email protected]/

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
Signature · 1 line
2.52.0