sched/fair: Move cpufreq hook to update_cfs_rq_load_avg()
The cpufreq hook should be called whenever the root cfs_rq utilization changes so update_cfs_rq_load_avg() is a better place for it. The current location is not invoked in the enqueue_entity() or update_blocked_averages() paths. Suggested-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Steve Muckle <smuckle@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Juri Lelli <Juri.Lelli@arm.com> Cc: Michael Turquette <mturquette@baylibre.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Morten Rasmussen <morten.rasmussen@arm.com> Cc: Patrick Bellasi <patrick.bellasi@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rafael J. Wysocki <rafael@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1458606068-7476-1-git-send-email-smuckle@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
1f621e028b
commit
21e96f8877
|
@ -2878,7 +2878,9 @@ static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq);
|
||||||
static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
|
static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
|
||||||
{
|
{
|
||||||
struct sched_avg *sa = &cfs_rq->avg;
|
struct sched_avg *sa = &cfs_rq->avg;
|
||||||
|
struct rq *rq = rq_of(cfs_rq);
|
||||||
int decayed, removed = 0;
|
int decayed, removed = 0;
|
||||||
|
int cpu = cpu_of(rq);
|
||||||
|
|
||||||
if (atomic_long_read(&cfs_rq->removed_load_avg)) {
|
if (atomic_long_read(&cfs_rq->removed_load_avg)) {
|
||||||
s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
|
s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);
|
||||||
|
@ -2893,7 +2895,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
|
||||||
sa->util_sum = max_t(s32, sa->util_sum - r * LOAD_AVG_MAX, 0);
|
sa->util_sum = max_t(s32, sa->util_sum - r * LOAD_AVG_MAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
decayed = __update_load_avg(now, cpu_of(rq_of(cfs_rq)), sa,
|
decayed = __update_load_avg(now, cpu, sa,
|
||||||
scale_load_down(cfs_rq->load.weight), cfs_rq->curr != NULL, cfs_rq);
|
scale_load_down(cfs_rq->load.weight), cfs_rq->curr != NULL, cfs_rq);
|
||||||
|
|
||||||
#ifndef CONFIG_64BIT
|
#ifndef CONFIG_64BIT
|
||||||
|
@ -2901,6 +2903,29 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
|
||||||
cfs_rq->load_last_update_time_copy = sa->last_update_time;
|
cfs_rq->load_last_update_time_copy = sa->last_update_time;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (cpu == smp_processor_id() && &rq->cfs == cfs_rq) {
|
||||||
|
unsigned long max = rq->cpu_capacity_orig;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There are a few boundary cases this might miss but it should
|
||||||
|
* get called often enough that that should (hopefully) not be
|
||||||
|
* a real problem -- added to that it only calls on the local
|
||||||
|
* CPU, so if we enqueue remotely we'll miss an update, but
|
||||||
|
* the next tick/schedule should update.
|
||||||
|
*
|
||||||
|
* It will not get called when we go idle, because the idle
|
||||||
|
* thread is a different class (!fair), nor will the utilization
|
||||||
|
* number include things like RT tasks.
|
||||||
|
*
|
||||||
|
* As is, the util number is not freq-invariant (we'd have to
|
||||||
|
* implement arch_scale_freq_capacity() for that).
|
||||||
|
*
|
||||||
|
* See cpu_util().
|
||||||
|
*/
|
||||||
|
cpufreq_update_util(rq_clock(rq),
|
||||||
|
min(sa->util_avg, max), max);
|
||||||
|
}
|
||||||
|
|
||||||
return decayed || removed;
|
return decayed || removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2922,29 +2947,6 @@ static inline void update_load_avg(struct sched_entity *se, int update_tg)
|
||||||
|
|
||||||
if (update_cfs_rq_load_avg(now, cfs_rq) && update_tg)
|
if (update_cfs_rq_load_avg(now, cfs_rq) && update_tg)
|
||||||
update_tg_load_avg(cfs_rq, 0);
|
update_tg_load_avg(cfs_rq, 0);
|
||||||
|
|
||||||
if (cpu == smp_processor_id() && &rq->cfs == cfs_rq) {
|
|
||||||
unsigned long max = rq->cpu_capacity_orig;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* There are a few boundary cases this might miss but it should
|
|
||||||
* get called often enough that that should (hopefully) not be
|
|
||||||
* a real problem -- added to that it only calls on the local
|
|
||||||
* CPU, so if we enqueue remotely we'll miss an update, but
|
|
||||||
* the next tick/schedule should update.
|
|
||||||
*
|
|
||||||
* It will not get called when we go idle, because the idle
|
|
||||||
* thread is a different class (!fair), nor will the utilization
|
|
||||||
* number include things like RT tasks.
|
|
||||||
*
|
|
||||||
* As is, the util number is not freq-invariant (we'd have to
|
|
||||||
* implement arch_scale_freq_capacity() for that).
|
|
||||||
*
|
|
||||||
* See cpu_util().
|
|
||||||
*/
|
|
||||||
cpufreq_update_util(rq_clock(rq),
|
|
||||||
min(cfs_rq->avg.util_avg, max), max);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
|
|
Loading…
Reference in New Issue