Re: [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask
From: Shrikanth Hegde
Date: Thu Nov 12 2026 - 00:21:25 EST
Hi Yury,
On 11/12/26 2:07 AM, Yury Norov wrote:
On Tue, Nov 10, 2026 at 04:15:31PM +1300, 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.
Hi Maxim,
Thank you for the feedback.
I agree, this trick with pinning a workload to an non-preferred CPU
looks promising for benchmarking purposes, and probably for more.
Sorry, i don't follow.
Did you mean pin to preferred CPUs? Why would anyone want to run their
workload only on non-preferred CPUs? By definition, they are not meant to
be used as much as possible. and It is benchmarking.
I'm going to split this series to the cleanup and follow-up parts.
In the follow-up, I'll focus on this writable interface. I'll keep
you in CC there.
Thanks,
Yury