sched/numa: fix possible uncapped numa_scan_period

Message ID 20230621035847.3349899-1-linmiaohe@huawei.com
State New
Headers
Series sched/numa: fix possible uncapped numa_scan_period |

Commit Message

Miaohe Lin June 21, 2023, 3:58 a.m. UTC
  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@huawei.com>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

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;