Re: [PATCH v4 14/20] sched/core: Introduce a simple steal monitor

From: Shrikanth Hegde

Date: Fri Jun 19 2026 - 02:27:40 EST



[...]

This monitor is the one implementation out of quite many possible,
right? I don't think it should live in the core scheduler files, it
should be a module.

I agree that this tight of an integration with the sched bits might not
not be required.


You mean similar to drivers/cpuidle/? a new one drivers/steal_monitor/ ?

Since steal time is a virtualization concept, somewhere in drivers/virt/
probably makes more sense unless we need some scheduler internal API to
implement it which shouldn't be the case.

All the driver has to do is track steal-time (which should be available
via kcpustat_cpu_fetch()) periodically (using a workqueue?) and should
do set_cpu_preferred() (which needs to be made available for other use
cases anyways) so it should be possible.

Yes. Seems like doable.

Do you think it would make sense to keep the debugfs in sched still?

The enable/disable part will be replaced with insmod/rmmod. The
statistics part - IDK. It is nice to have all stats at the same
place. On the other hand, without the driver loaded it would
always read zeroes. It anyways is just a single line in sched/core.c,
not a big deal.


I was asking about these debugfs knobs.

steal_monitor/high_threshold:500
steal_monitor/low_threshold:200
steal_monitor/sampling_period:1000

Those are the driver defaults. And if you want to override one, then:

insmod steal_monitor.ko high_threshold=400

ok.

I will try moving steal monitor into a driver.
- create a new one in drivers/virt named as steal_monitor
- enable/disable will be insmod/rmmod
- debug knobs will be module parameters.
- there will be default hooks, any arch needs specific handling it needs to do
by adding its specific file. (somewhat close to cpuidle)


PS:
Sashiko too had some interesting comments for the series.
I have fixed a few.
https://sashiko.dev/#/patchset/20260617174139.155540-1-sshegde%40linux.ibm.com