[PATCH v7 00/12] sched, steal_monitor: Introduce cpu_preferred_mask and steal-driven vCPU backoff

From: Shrikanth Hegde

Date: Thu Jul 09 2026 - 17:57:52 EST


Very briefly,
- Maintain set of CPUs which can be used by workload. It is denoted as
cpu_preferred_mask
- Periodically compute the steal time. If steal time is high/low based
on the thresholds, either reduce/increase the preferred CPUs. This is
handled in a new driver called steal_monitor
- If a CPU is marked as non-preferred, push the task running on it if
possible.
- Use this CPU state in wakeup and load balance to ensure tasks run
within preferred CPUs.

For more details on idea, problem statement and performance numbers,
please refer to cover-letter of v2[2] and OSPM talk[1].

*** Please review and provide your feedback!! ***

[1]:https://youtu.be/adxUKFPlOp0
[2] v2: https://lore.kernel.org/all/20260407191950.643549-1-sshegde@xxxxxxxxxxxxx/#t
[3] v6: https://lore.kernel.org/all/20260701141654.500125-1-sshegde@xxxxxxxxxxxxx/#t

Thank you very much for feedback so far. This has helped the code to
evolve towards a clear abstraction layers and get simplified.
Special thanks to Yury Norov for reviewing this and improving the series
significantly. Really appreciated.

Apologies in advance if I have missed addressing any
comments. If so would be purely accidental, not in any way intentional.

base commit:
tip/sched/core at 'commit 04998aa54848 ("sched/eevdf: Delayed dequeue task can't preempt")'

v6->v7:
- Make new driver steal_monitor into 4-5 patches. (Yury Norov)
- Define CONFIG_STEAL_MONITOR and Make it select CONFIG_PREFERRED_CPU
(Yury Norov)
- Make module parameters fixed at module load (Yury Norov)
- Make module parameters checks using set/get methods via module_param_cb - sashiko
- Simplify is_cpu_allowed. (Yury Norov)
- Added MAINTAINERS entry for new driver.
- Split nohz_full optimization into its own patch.
- Merged load balance patches.
- Use possible CPUs instead of active for steal value calculations.
- Drop __weak symbol for now. Once the need arises, framework can be
designed at that time. (Yury Norov)
- remove whitespace in scoped_guard (Yury Norov)
- remove class check in sched_push_current_non_preferred_cpu (Yury
Norov)
- Make empty stub to do { } while (0) in set_cpu_preferred
- Move is_migration_disabled check to sched_non_preferred_cpu_push_stop - Sashiko
- Increase the migration count only if rq changed - sashiko
- Add missing requeue work on early return - sashiko
- Use WARN_ON_ONCE for design checks instead of WARN_ON.
- Few updates to documentation, comments and changelogs.

Let me know if there is any critical information is missing
regarding new driver such as policy, documentation or missing
implementation. I have ensured checkpatch --strict is happy.

Shrikanth Hegde (12):
sched/docs: Document cpu_preferred_mask and Preferred CPU concept
cpumask: Introduce cpu_preferred_mask
sysfs: Add preferred CPU file
sched/core: Try to use a preferred CPU in is_cpu_allowed
sched/fair: Load balance only among preferred CPUs
sched/core: Push current task from non preferred CPU
sched/debug: Add migration stats due to non preferred CPUs
virt: Introduce steal monitor driver
virt/steal_monitor: Add control knobs for handling steal values
virt/steal_monitor: Provide functions for managing steal values
virt/steal_monitor: Act on steal time periodically and decide on
preferred CPUs
sched, virt/steal_monitor: Keep tick on for faster push on nohz_full
CPU

.../ABI/testing/sysfs-devices-system-cpu | 11 +
Documentation/driver-api/index.rst | 1 +
Documentation/driver-api/steal-monitor.rst | 111 ++++++++++
Documentation/scheduler/sched-arch.rst | 58 +++++
MAINTAINERS | 9 +
drivers/base/cpu.c | 8 +
drivers/virt/Kconfig | 2 +
drivers/virt/Makefile | 1 +
drivers/virt/steal_monitor/Kconfig | 18 ++
drivers/virt/steal_monitor/Makefile | 6 +
drivers/virt/steal_monitor/defaults.c | 107 ++++++++++
drivers/virt/steal_monitor/sm_core.c | 202 ++++++++++++++++++
drivers/virt/steal_monitor/sm_core.h | 37 ++++
include/linux/cpumask.h | 24 +++
include/linux/sched.h | 1 +
kernel/Kconfig.preempt | 3 +
kernel/cpu.c | 6 +
kernel/sched/core.c | 105 ++++++++-
kernel/sched/debug.c | 1 +
kernel/sched/fair.c | 11 +-
kernel/sched/sched.h | 20 ++
21 files changed, 737 insertions(+), 5 deletions(-)
create mode 100644 Documentation/driver-api/steal-monitor.rst
create mode 100644 drivers/virt/steal_monitor/Kconfig
create mode 100644 drivers/virt/steal_monitor/Makefile
create mode 100644 drivers/virt/steal_monitor/defaults.c
create mode 100644 drivers/virt/steal_monitor/sm_core.c
create mode 100644 drivers/virt/steal_monitor/sm_core.h

--
2.47.3