[PATCH] sched/numa: Reset NUMA fault locality after scan period update
From: Eric Kim
Date: Mon Aug 03 2026 - 03:54:45 EST
When updating the task scan period for NUMA locality checks,
update_task_scan_period should increase the scan periods
either when there were no faults or when there is a failed migration
attempt. However, numa_faults_locality which is used to check for
migration failure and number of faults is not cleared when it is in
this state, causing stale migration and fault information to affect
later decisions.
clear numa_faults_locality after updating the scan period so that
at each update it uses newly collected information.
Reported-by: Binwon Song <qlsdnjs236@xxxxxxxxxxxxxx>
Link: https://lore.kernel.org/all/20250404095354.311156-1-qlsdnjs236@xxxxxxxxxxxxxx/
Signed-off-by: Eric Kim <seohyun.kim@xxxxxxxxxx>
Changes in v2:
- Share numa_faults_locality reset path with the tail of
update_task_scan_period as suggested by Peter Zijlstra.
---
kernel/sched/fair.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d78467ec6ee13..85d5568669543 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3469,7 +3469,7 @@ static void update_task_scan_period(struct task_struct *p,
p->mm->numa_next_scan = jiffies +
msecs_to_jiffies(p->numa_scan_period);
- return;
+ goto out;
}
/*
@@ -3513,7 +3513,10 @@ static void update_task_scan_period(struct task_struct *p,
p->numa_scan_period = clamp(p->numa_scan_period + diff,
task_scan_min(p), task_scan_max(p));
- memset(p->numa_faults_locality, 0, sizeof(p->numa_faults_locality));
+
+out:
+ memset(p->numa_faults_locality, 0,
+ sizeof(p->numa_faults_locality));
}
/*
--
2.55.0