[PATCH 1/5] sched/numa: Let other scheduling classes drive NUMA scanning
From: Andrea Righi
Date: Sun Oct 04 2026 - 03:29:40 EST
The periodic scan that installs the NUMA hinting faults is driven by
task_tick_numa(), which is reachable only from task_tick_fair(). What
the scan feeds is class independent, but a task that is not in the fair
class is never scanned, records no faults and never gets a preferred
node.
Make task_tick_numa() available to the other scheduling classes (e.g.,
sched_ext). Declare it in sched.h and move the !CONFIG_NUMA_BALANCING
stub there, so a class that has no interest in NUMA balancing keeps
costing nothing.
No functional change: task_tick_fair() remains the only caller.
Reported-by: Vladimir Vdovin <deliran@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20261002124559.10367-1-deliran@xxxxxxxxxx
Signed-off-by: Andrea Righi <arighi@xxxxxxxxxx>
---
kernel/sched/fair.c | 6 +-----
kernel/sched/sched.h | 5 +++++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 03206e15e6fe4..e2d52faacdb7a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4431,7 +4431,7 @@ void init_numa_balancing(u64 clone_flags, struct task_struct *p)
/*
* Drive the periodic memory faults..
*/
-static void task_tick_numa(struct rq *rq, struct task_struct *curr)
+void task_tick_numa(struct rq *rq, struct task_struct *curr)
{
struct callback_head *work = &curr->numa_work;
u64 period, now;
@@ -4497,10 +4497,6 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
#else /* !CONFIG_NUMA_BALANCING: */
-static void task_tick_numa(struct rq *rq, struct task_struct *curr)
-{
-}
-
static inline void account_numa_enqueue(struct rq *rq, struct task_struct *p)
{
}
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 0a34f0da1ec36..30232341db9de 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2137,6 +2137,7 @@ extern int migrate_task_to(struct task_struct *p, int cpu);
extern int migrate_swap(struct task_struct *p, struct task_struct *t,
int cpu, int scpu);
extern void init_numa_balancing(u64 clone_flags, struct task_struct *p);
+extern void task_tick_numa(struct rq *rq, struct task_struct *curr);
#else /* !CONFIG_NUMA_BALANCING: */
@@ -2145,6 +2146,10 @@ init_numa_balancing(u64 clone_flags, struct task_struct *p)
{
}
+static inline void task_tick_numa(struct rq *rq, struct task_struct *curr)
+{
+}
+
#endif /* !CONFIG_NUMA_BALANCING */
int task_llc(const struct task_struct *p);
--
2.55.0