Skip to content

Commit bb1937c

Browse files
kerneltoastPixelBoot
authored andcommitted
sched/fair: Compile out NUMA code entirely when NUMA is disabled
Scheduler code is very hot and every little optimization counts. Instead of constantly checking sched_numa_balancing when NUMA is disabled, compile it out. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
1 parent a32d5a4 commit bb1937c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

kernel/sched/fair.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,7 +2260,8 @@ void task_numa_fault(int last_cpupid, int mem_node, int pages, int flags)
22602260
int local = !!(flags & TNF_FAULT_LOCAL);
22612261
int priv;
22622262

2263-
if (!static_branch_likely(&sched_numa_balancing))
2263+
if (!IS_ENABLED(CONFIG_NUMA_BALANCING) ||
2264+
!static_branch_likely(&sched_numa_balancing))
22642265
return;
22652266

22662267
/* for example, ksmd faulting in a user's mm */
@@ -10130,7 +10131,8 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
1013010131
entity_tick(cfs_rq, se, queued);
1013110132
}
1013210133

10133-
if (static_branch_unlikely(&sched_numa_balancing))
10134+
if (IS_ENABLED(CONFIG_NUMA_BALANCING) &&
10135+
static_branch_unlikely(&sched_numa_balancing))
1013410136
task_tick_numa(rq, curr);
1013510137

1013610138
#ifdef CONFIG_SMP

0 commit comments

Comments
 (0)