Re: [PATCH v4 1/1] powerpc: enable dynamic preemption

From: Jirka Hladky

Date: Tue Jul 28 2026 - 10:27:19 EST


On Tue, Jul 28, 2026 at 7:12 AM Shrikanth Hegde <sshegde@xxxxxxxxxxxxx> wrote:
> No. It doesn't confirm. I would recommend you do that case to find out
> the cost of PREEMPT_RCU alone.
>
> Config A: CONFIG_PREEMPT_VOLUNTARY=y (CONFIG_PREEMPT_DYNAMIC=n)
> Config B: CONFIG_PREEMPT_VOLUNTARY=y (CONFIG_PREEMPT_DYNAMIC=y)

Done. Built two kernels from 6.18 upstream source on the same POWER10
machine. Both are voluntary preemption, differing only in
PREEMPT_DYNAMIC (and thus PREEMPT_RCU):

Config A: PREEMPT_VOLUNTARY=y, PREEMPT_DYNAMIC=n (no PREEMPT_RCU)
Config B: PREEMPT_VOLUNTARY=y, PREEMPT_DYNAMIC=y (PREEMPT_RCU=y)

Config B runtime mode confirmed as voluntary:
cat /sys/kernel/debug/sched/preempt: "none (voluntary) full lazy"

Results (stress-ng --kill 1 -t 23, SELinux enforcing, mean of 3 runs):

Kernel PREEMPT_RCU kill bogo-ops/sec stddev
---------------------- ----------- ----------------- ------
6.18.0-vol-nodynamic no 108,836 19
6.18.0-vol-dynamic yes 68,197 1,146
Delta -37.3%

PREEMPT_RCU alone costs 37.3% on ppc64le with zero preemption mode
change. Both kernels run voluntary preemption.

> That's true for all archs. Please check your preemption mode in your
> x86 experiment.

Checked. On x86_64 (AMD EPYC 7313):

Kernel PREEMPT_RCU Runtime mode kill bogo-ops/sec
------------------- ----------- ------------------ -----------------
6.12.0-211 (el10) yes none (voluntary) 37,436
7.2.0-rc4 (eln158) yes full (lazy) 36,392 (-2.8%)

Both x86 kernels already had PREEMPT_RCU=y, so the x86 comparison
only shows the voluntary->lazy mode change cost (~3%), not the
PREEMPT_RCU enablement cost.

> 1. Is not true. PREEMPT_DYNAMIC doesn't force the preemption mode
> switch. You can still choose voluntary even with PREEMPT_DYNAMIC on
> 6.16 to 6.19 kernel.

You are correct, I apologize for the error. The forced switch to
lazy/full happened only in 7.0 with commit 7dadeaa6e851. On 6.16-6.19,
voluntary is still available with PREEMPT_DYNAMIC, as confirmed by
Config B above:

$ cat /sys/kernel/debug/sched/preempt
none (voluntary) full lazy

Jirka