@@ -2959,6 +2959,11 @@ static void calc_load_account_active(struct rq *this_rq)
{
long nr_active, delta;
+ if (!time_after_eq(jiffies, this_rq->calc_load_update))
+ return;
+
+ this_rq->calc_load_update += LOAD_FREQ;
+
nr_active = this_rq->nr_running;
nr_active += (long) this_rq->nr_uninterruptible;
@@ -2998,10 +3003,7 @@ static void update_cpu_load(struct rq *this_rq)
this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i;
}
- if (time_after_eq(jiffies, this_rq->calc_load_update)) {
- this_rq->calc_load_update += LOAD_FREQ;
- calc_load_account_active(this_rq);
- }
+ calc_load_account_active(this_rq);
}
#ifdef CONFIG_SMP
@@ -3394,9 +3394,11 @@ static void run_rebalance_domains(struct softirq_action *h)
if (need_resched())
break;
+ rq = cpu_rq(balance_cpu);
+ calc_load_account_active(rq);
+
rebalance_domains(balance_cpu, CPU_IDLE);
- rq = cpu_rq(balance_cpu);
if (time_after(this_rq->next_balance, rq->next_balance))
this_rq->next_balance = rq->next_balance;
}
@@ -23,8 +23,6 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p, int fl
static struct task_struct *pick_next_task_idle(struct rq *rq)
{
schedstat_inc(rq, sched_goidle);
- /* adjust the active tasks as we might go into a long sleep */
- calc_load_account_active(rq);
return rq->idle;
}