Re: [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask
From: Shrikanth Hegde
Date: Tue Nov 10 2026 - 04:21:36 EST
Hi,
On 11/10/26 8:45 AM, Maxim Kuvyrkov wrote:
On Nov 2, 2026, at 08:21, Yury Norov <ynorov@xxxxxxxxxx> wrote:
The preferred CPU mask currently lets the steal governor reduce vCPU
demand when physical CPUs are contended. This series adds manual control,
opening more use cases.
For example, setting CPUs aside for selected fair tasks at runtime while
steering other fair tasks toward the remaining CPUs.
Hi Yury,
I've been trying to do this with crutches in user-space for a long time. Thanks for implementing this in the kernel, and with a convenient user interface.
A user can mark a CPU non-preferred and pin a workload to it. Fair tasks
whose affinity includes preferred CPUs are steered away, while tasks
whose allowed CPUs contain no preferred CPU can still run there. The CPU
stays online, task affinity is preserved, and the selection can be
reversed without rebooting:
# rmmod steal_governor
# echo 0 > /sys/devices/system/cpu/cpu3/preferred
# taskset -c 3 ./my_workload
# echo 1 > /sys/devices/system/cpu/cpu3/preferred
My use-case (being a compiler optimization engineer) is to pin benchmarks to specific cores, and stop the system from using those cores even when the cores are idle. This prevents L1/L2 cache pollution and makes performance numbers more stable.
Do you change it when running workload based on any signal/event? or you set it before starting it?
If it is set before starting, you might as well offline the CPUs to achieve the same. I assume you are
managing the preferred CPUs manually with write interface. You can do the same for online state.
(Though it takes a longer)
Thanks!
--
Maxim Kuvyrkov
Garden City Compilers