[RFC PATCH] sched/numa: fix bug in update_task_scan_period
From: 丁天琛
Date: Tue Aug 11 2020 - 04:30:36 EST
When p->numa_faults_locality[2] > 0, numa_scan_period is doubled, but
this array will never be cleared, which causes scanning period always
reaching its max value. This patch clears numa_faults_locality after
numa_scan_period being doubled to fix this bug.
Signed-off-by: Tianchen Ding <tianchen.dingtianc@xxxxxxxxxxxxxxx>
Signed-off-by: Michael Wang <yun.wang@xxxxxxxxxxxxxxxxx>
---
kernel/sched/fair.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1a68a0536add..a61ee408202e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2180,6 +2180,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