[PATCH v3] sched/fair: Reset NUMA fault locality after scan period update
Eric Kim <[email protected]>
| Newsgroups | org.kernel.vger.stable,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <OS7PR01MB13914CB69D682A599970F258C96A62@OS7PR01MB13914.jpnprd01.prod.outlook.com> |
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. Reported-by: Binwon Song <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Eric Kim <[email protected]> --- v3: - Polished commit message for clarity and updated subsystem prefix to sched/fair. v2: - Share numa_faults_locality reset path with the tail of update_task_scan_period.(Peter zijlstra) - Link: https://lore.kernel.org/all/OS7PR01MB139144C7E07C97B3F3B47016796D52@OS7PR01MB13914.jpnprd01.prod.outlook.com/ v1: - Link: https://lore.kernel.org/all/OS7PR01MB13914DA08AC588DE5544B03E796D62@OS7PR01MB13914.jpnprd01.prod.outlook.com/ 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 f15f5764818e..b067f6bcd941 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