[PATCH 06/15] sched/core: Dynamically update scheduler domain housekeeping mask

Qiliang Yuan
2026-03-25T09:10:31Z

Scheduler domains rely on HK_TYPE_DOMAIN to identify which CPUs are
isolated from general load balancing. Currently, these boundaries are
static and determined only during boot-time domain initialization.

Trigger a scheduler domain rebuild when the HK_TYPE_DOMAIN mask changes.

This ensures that scheduler isolation boundaries can be reconfigured
at runtime via the DHEI sysfs interface.

Signed-off-by: Qiliang Yuan <realwujing@gmail.com>
---
kernel/sched/core.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 045f83ad261e2..ddf9951f1438c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -39,6 +39,7 @@
#include <linux/sched/nohz.h>
#include <linux/sched/rseq_api.h>
#include <linux/sched/rt.h>
+#include <linux/sched/topology.h>

#include <linux/blkdev.h>
#include <linux/context_tracking.h>
@@ -10832,3 +10833,25 @@ void sched_change_end(struct sched_change_ctx *ctx)
p->sched_class->prio_changed(rq, p, ctx->prio);
}
}
+
+static int sched_housekeeping_update(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct housekeeping_update *update = data;
+
+ if (action == HK_UPDATE_MASK && update->type == HK_TYPE_DOMAIN)
+ rebuild_sched_domains();
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block sched_housekeeping_nb = {
+ .notifier_call = sched_housekeeping_update,
+};
+
+static int __init sched_housekeeping_init(void)
+{
+ housekeeping_register_notifier(&sched_housekeeping_nb);
+ return 0;
+}
+late_initcall(sched_housekeeping_init);

--
2.43.0