Skip to contentSkip to conversation

Remove redundant sched_numa_balancing check.

RFC PATCH In review Imran Khan 2 participants 3 messages Jan 18, 2021 Scheduler

lore
Share & tools
lore

Imran Khan

author
#0 lore raw

RFC PATCH 1/1 Remove redundant sched_numa_balancing check.

task_numa_fault is invoked from do_numa_page/do_huge_pmd_numa_page, for task_numa_work induced memory faults. task_numa_work is scheduled from task_tick_numa which is invoked only if sched_numa_balancing is true.

So task_numa_fault will not get invoked if sched_numa_balancing is false and hence we can avoid checking it again in task_numa_fault.

---
 kernel/sched/fair.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/sched/fair.c +0 -3
index 04a3ce20da67..282ebd6c4197 100644
@@ -2643,9 +2643,6 @@ void task_numa_fault(int last_cpupid, int mem_node, int pages, int flags)
 	struct numa_group *ng;
 	int priv;
 
-	if (!static_branch_likely(&sched_numa_balancing))
-		return;
-
 	/* for example, ksmd faulting in a user's mm */
 	if (!p->mm)
 		return;
Signature · 1 line
2.25.1
reviewer
#1 lore raw
Quoted 9 lines · Imran Khan

task_numa_fault is invoked from do_numa_page/do_huge_pmd_numa_page, for task_numa_work induced memory faults. task_numa_work is scheduled from task_tick_numa which is invoked only if sched_numa_balancing is true.

So task_numa_fault will not get invoked if sched_numa_balancing is false and hence we can avoid checking it again in task_numa_fault.

If NUMA balancing is disabled at runtime, there may still be PTEs that are marked for NUMA balancing. While these still get handled at fault, there is no point tracking the fault information in task_numa_fault and this function can still get called after sched_numa_balancing is disabled.

Signature · 2 lines
Mel Gorman
SUSE Labs
author
#2 lore raw
Quoted 9 lines · Mel Gorman
Quoted 8 lines · Imran Khan

task_numa_fault is invoked from do_numa_page/do_huge_pmd_numa_page, for task_numa_work induced memory faults. task_numa_work is scheduled from task_tick_numa which is invoked only if sched_numa_balancing is true.

So task_numa_fault will not get invoked if sched_numa_balancing is false and hence we can avoid checking it again in task_numa_fault.

Quoted 8 lines
Quoted 1 line

If NUMA balancing is disabled at runtime, there may still be PTEs that are marked for NUMA balancing. While these still get handled at fault, there is no point tracking the fault information in task_numa_fault and this function can still get called after sched_numa_balancing is disabled.

Okay, understood. Thanks for clarifying.