[PATCH] sched/numa: fix possible uncapped numa_scan_period

From: Miaohe Lin
Date: Tue Jun 20 2023 - 23:59:44 EST


The unit of task_scan_max() is ms while ns is expected. This will lead
to task_scan_max() being ineffective.

Fixes: 137844759843 ("sched/numa: Stagger NUMA balancing scan periods for new threads")
Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3cc06cfca350..5e90e9658528 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3175,7 +3175,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
if (mm) {
unsigned int delay;

- delay = min_t(unsigned int, task_scan_max(current),
+ delay = min_t(unsigned int, task_scan_max(current) * NSEC_PER_MSEC,
current->numa_scan_period * mm_users * NSEC_PER_MSEC);
delay += 2 * TICK_NSEC;
p->node_stamp = delay;
--
2.27.0