Hi,

On 2023-10-08 06:20, Johannes Schauer Marin Rodrigues wrote:
> I'm wondering whether it'd make sense for the Debian kernel to be built with
> CONFIG_PREEMPT_DYNAMIC=y.

On amd64 we already have PREEMPT_DYNAMIC=y, so I thought of running some
benchmarks on my Ryzen system to evaluate the performance overhead it
introduces.

To my surprise, I found that in Debian you get a 20% (!) performance
improvement on kernel-heavy workloads simply by setting PREEMPT_DYNAMIC
to 'n'. I brought up the topic on LKML [1], and it turns out that what
is really eating performance for us is DEBUG_PREEMPT=y. There is a
performance penalty in PREEMPT_DYNAMIC=y as well, but it's much smaller,
around 3 or 4%.

The Kconfig help entry for DEBUG_PREEMPT also clearly mentions the
performance overhead:

 This option has potential to introduce high runtime overhead,
 depending on workload as it triggers debugging routines for each
 this_cpu operation. It should only be used for debugging purposes.

Regardless of what we are going to decide about PREEMPT_DYNAMIC, we
surely have to disable DEBUG_PREEMPT. I opened [2] for that.

[1] https://lore.kernel.org/lkml/ZTJFA_Ac6nWawIHb@ariel/
[2] https://salsa.debian.org/kernel-team/linux/-/merge_requests/874

Reply via email to