se->avg.load_avg_contrib >>= NICE_0_SHIFT;
}
}
-#else
+#else /* CONFIG_FAIR_GROUP_SCHED */
static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq,
int force_update) {}
static inline void __update_tg_runnable_avg(struct sched_avg *sa,
struct cfs_rq *cfs_rq) {}
static inline void __update_group_entity_contrib(struct sched_entity *se) {}
-#endif
+#endif /* CONFIG_FAIR_GROUP_SCHED */
static inline void __update_task_entity_contrib(struct sched_entity *se)
{
update_rq_runnable_avg(this_rq, 0);
}
+static int idle_balance(struct rq *this_rq);
+
#else /* CONFIG_SMP */
static inline void update_entity_load_avg(struct sched_entity *se,
int sleep) {}
static inline void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq,
int force_update) {}
+
+static inline int idle_balance(struct rq *rq)
+{
+ return 0;
+}
+
#endif /* CONFIG_SMP */
static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
struct sched_entity *se;
struct task_struct *p;
-again: __maybe_unused
+again:
#ifdef CONFIG_FAIR_GROUP_SCHED
if (!cfs_rq->nr_running)
goto idle;
return p;
idle:
-#ifdef CONFIG_SMP
- idle_enter_fair(rq);
- /*
- * We must set idle_stamp _before_ calling idle_balance(), such that we
- * measure the duration of idle_balance() as idle time.
- */
- rq->idle_stamp = rq_clock(rq);
- if (idle_balance(rq)) { /* drops rq->lock */
- rq->idle_stamp = 0;
+ if (idle_balance(rq)) /* drops rq->lock */
goto again;
- }
-#endif
return NULL;
}
* idle_balance is called by schedule() if this_cpu is about to become
* idle. Attempts to pull tasks from other CPUs.
*/
-int idle_balance(struct rq *this_rq)
+static int idle_balance(struct rq *this_rq)
{
struct sched_domain *sd;
int pulled_task = 0;
u64 curr_cost = 0;
int this_cpu = this_rq->cpu;
+ idle_enter_fair(this_rq);
+ /*
+ * We must set idle_stamp _before_ calling idle_balance(), such that we
+ * measure the duration of idle_balance() as idle time.
+ */
+ this_rq->idle_stamp = rq_clock(this_rq);
+
if (this_rq->avg_idle < sysctl_sched_migration_cost)
- return 0;
+ goto out;
/*
* Drop the rq->lock, but keep IRQ/preempt disabled.
* While browsing the domains, we released the rq lock.
* A task could have be enqueued in the meantime
*/
- if (this_rq->nr_running && !pulled_task)
- return 1;
+ if (this_rq->nr_running && !pulled_task) {
+ pulled_task = 1;
+ goto out;
+ }
if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
/*
if (curr_cost > this_rq->max_idle_balance_cost)
this_rq->max_idle_balance_cost = curr_cost;
+out:
+ if (pulled_task)
+ this_rq->idle_stamp = 0;
+
return pulled_task;
}