Re: [PATCH v3 15/20] sched/core: Introduce a simple steal monitor

From: Ilya Leoshkevich

Date: Mon Jun 08 2026 - 12:38:14 EST




On 5/14/26 17:21, Shrikanth Hegde wrote:
Start with a simple steal monitor.

It is meant to look at steal time and make the decision to
reduce/increase the preferred CPUs.

It has
- work function to execute the steal time calculations and decision
making periodically.
- temporary cpumask, which will be used in the work function. This helps
to avoid cpumask allocation in periodic work function.
- low and high thresholds for steal time.
- sampling period to control the frequency of steal time calculations.
- cache the previous decision to avoid oscillations

Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
include/linux/sched.h | 13 +++++++++++++
kernel/sched/core.c | 24 ++++++++++++++++++++++++
kernel/sched/sched.h | 3 +++
3 files changed, 40 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index dcfb57c90850..ee5f19a96118 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h

[...]

@@ -11351,4 +11353,26 @@ void sched_push_current_non_preferred_cpu(struct rq *rq)
push_task, this_cpu_ptr(&npc_push_task_work));
local_irq_restore(flags);
}
+
+struct steal_monitor_t steal_mon;
+
+void sched_init_steal_monitor(void)
+{
+ INIT_WORK(&steal_mon.work, sched_steal_detection_work);
+ zalloc_cpumask_var(&steal_mon.tmp_mask, GFP_KERNEL);

Error handling is missing.

[...]