[tip: sched/core] sched/fair: Reset NUMA fault locality after scan period update
From: tip-bot2 for Eric Kim
Date: Thu Sep 10 2026 - 05:34:57 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e81ee06308379a5f2ededf997bcf17551bce5db7
Gitweb: https://git.kernel.org/tip/e81ee06308379a5f2ededf997bcf17551bce5db7
Author: Eric Kim <seohyun.kim@xxxxxxxxxx>
AuthorDate: Tue, 18 Aug 2026 12:48:29 +09:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Thu, 10 Sep 2026 11:01:30 +02:00
sched/fair: Reset NUMA fault locality after scan period update
When updating the task scan period for NUMA locality checks,
update_task_scan_period() checks whether there were no faults or failed
migration on the last scan window, at which it prolongs the scan period.
However, p->numa_faults_locality, which is used to check for migration
failure and number of faults at the previous scan window is not cleared
after changing the scan period, which unintentionally increases
numa_scan_period up to numa_scan_period_max even when there were no
migration failures or no faults at previous scan.
Fix this by jumping to the out label on early exit at this case to
ensure p->numa_faults_locality is always cleared before returning.
Closes: https://lore.kernel.org/all/20250404095354.311156-1-qlsdnjs236@xxxxxxxxxxxxxx/
Reported-by: Binwon Song <qlsdnjs236@xxxxxxxxxxxxxx>
Signed-off-by: Eric Kim <seohyun.kim@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Link: https://patch.msgid.link/Message-ID:
---
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 b8bd308..a42360c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3514,7 +3514,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;
}
/*
@@ -3558,7 +3558,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));
}
/*