Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched: Factor out the on_null_domain() checks in trigger_load_balance()

The test on_null_domain is done twice in the trigger_load_balance function.

Move the test at the begin of the function, so there is only one check.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1389008085-9069-9-git-send-email-daniel.lezcano@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Daniel Lezcano and committed by
Ingo Molnar
c726099e 208cb16b

+5 -3
+5 -3
kernel/sched/fair.c
··· 6878 6878 void trigger_load_balance(struct rq *rq) 6879 6879 { 6880 6880 /* Don't need to rebalance while attached to NULL domain */ 6881 - if (time_after_eq(jiffies, rq->next_balance) && 6882 - likely(!on_null_domain(rq))) 6881 + if (unlikely(on_null_domain(rq))) 6882 + return; 6883 + 6884 + if (time_after_eq(jiffies, rq->next_balance)) 6883 6885 raise_softirq(SCHED_SOFTIRQ); 6884 6886 #ifdef CONFIG_NO_HZ_COMMON 6885 - if (nohz_kick_needed(rq) && likely(!on_null_domain(rq))) 6887 + if (nohz_kick_needed(rq)) 6886 6888 nohz_balancer_kick(); 6887 6889 #endif 6888 6890 }