Re: [PATCH v4 03/20] kconfig: Provide PREFERRED_CPU option

From: Yury Norov

Date: Wed Jun 17 2026 - 20:51:35 EST


On Wed, Jun 17, 2026 at 11:11:22PM +0530, Shrikanth Hegde wrote:
> Introduce a new config named PREFERRED_CPU.
>
> This helps to:
> - Avoid the code bloat when PREFERRED_CPU=n. In that cases preferred
> is same as active.
> - Avoid the ifdeffery around PREFERRED_CPU in many files.
>
> Since paravirtulized use case is the main driving force of this
> feature, make it default for kernels with PARAVIRT=y
>
> Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
> ---
> kernel/Kconfig.preempt | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
> index 88c594c6d7fc..0995f5ba66eb 100644
> --- a/kernel/Kconfig.preempt
> +++ b/kernel/Kconfig.preempt
> @@ -192,3 +192,16 @@ config SCHED_CLASS_EXT
> For more information:
> Documentation/scheduler/sched-ext.rst
> https://github.com/sched-ext/scx
> +
> +config PREFERRED_CPU
> + bool "Dynamic vCPU management based on steal time"
> + default y if PARAVIRT && SMP
> + help
> + This feature helps to reduce the steal time in paravirtualised
> + environment, there by reducing vCPU preemption. Reducing vCPU
> + preemption provides improved lock holder preemption and reduces
> + cost of vCPU preemption in the host.

If it doesn't make sense for non-paravirt kernels, then

depends on PARAVIRT && SMP
default y

> +
> + By default preferred CPUs will be same as active CPUs. Depending
> + on the steal time when steal monitor is enabled, preferred CPUs
> + could become subset of active CPUs.
> --
> 2.47.3