Skip to content

Commit

Permalink
sched/fair: Compile out NUMA code entirely when NUMA is 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 <sultan@kerneltoast.com>
  • Loading branch information
kerneltoast authored and vantoman committed Oct 16, 2021
1 parent 249e24e commit af5957c
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 @@ -2492,7 +2492,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 @@ -12442,7 +12443,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 af5957c

Please sign in to comment.