Re: [PATCH 0/6] sched: Expose writable interface for preferred CPUs mask

From: Mete Durlu

Date: Thu Nov 12 2026 - 05:04:08 EST


Hi Shrikanth,

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 think they want to prevent anything else *besides* their workload
from running on these CPUs by marking them non-preferred and then
pinning their workload there.
Sort of like like dynamically configurable isolated CPUs.

IMO this fits 1-1 with what Yury is describing with this patchset.

Thanks,
-Mete