Skip to content

Commit

Permalink
sched/fair: Compile out NUMA code entirely when disabled
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: LibXZR <[email protected]>
Signed-off-by: atndko <[email protected]>
  • Loading branch information
kerneltoast authored and Official-Ayrton990 committed Jun 6, 2022
1 parent 2c5530c commit 7a49bfe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,8 @@ 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))
if (!IS_ENABLED(CONFIG_NUMA_BALANCING) ||
!static_branch_likely(&sched_numa_balancing))
return;

/* for example, ksmd faulting in a user's mm */
Expand Down Expand Up @@ -11746,7 +11747,8 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
entity_tick(cfs_rq, se, queued);
}

if (static_branch_unlikely(&sched_numa_balancing))
if (IS_ENABLED(CONFIG_NUMA_BALANCING) &&
static_branch_unlikely(&sched_numa_balancing))
task_tick_numa(rq, curr);

update_misfit_status(curr, rq);
Expand Down

0 comments on commit 7a49bfe

Please sign in to comment.