[PATCH] sched/numa: clear locality statistics on early return
From: Hongling Zeng
Date: Tue Aug 04 2026 - 05:13:19 EST
A non-zero migration-failure locality statistic causes
update_task_scan_period() to take the slow-scan path and return before
the locality statistics are cleared.
Consequently, the same migration failure can affect subsequent
scan-period updates and repeatedly select the slow-scan path until the
maximum scan period is reached.
Clear the locality statistics before returning from the slow-scan path,
matching the cleanup performed by the normal path. This allows later
scan-period updates to use fresh locality and migration statistics.
Fixes: f307cd1a32fa ("sched/numa: Slow scan rate if no NUMA hinting faults are being recorded")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hongling Zeng <zenghongling@xxxxxxxxxx>
---
kernel/sched/fair.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 78f8dc4cf5ea..676fe1c3356e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3518,6 +3518,8 @@ static void update_task_scan_period(struct task_struct *p,
p->mm->numa_next_scan = jiffies +
msecs_to_jiffies(p->numa_scan_period);
+ memset(p->numa_faults_locality, 0,
+ sizeof(p->numa_faults_locality));
return;
}
--
2.25.1