[PATCH 7/7] sched: factor out on_null_domain check in trigger_load_balance function

From: Daniel Lezcano
Date: Mon Dec 30 2013 - 08:45:15 EST


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@xxxxxxxxxx>
---
kernel/sched/fair.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 59c57e7..ef95ddf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6871,11 +6871,13 @@ static inline int on_null_domain(struct rq *rq)
void trigger_load_balance(struct rq *rq)
{
/* Don't need to rebalance while attached to NULL domain */
- if (time_after_eq(jiffies, rq->next_balance) &&
- likely(!on_null_domain(rq)))
+ if (unlikely(on_null_domain(rq)))
+ return;
+
+ if (time_after_eq(jiffies, rq->next_balance))
raise_softirq(SCHED_SOFTIRQ);
#ifdef CONFIG_NO_HZ_COMMON
- if (nohz_kick_needed(rq) && likely(!on_null_domain(rq)))
+ if (nohz_kick_needed(rq))
nohz_balancer_kick();
#endif
}
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/