| From | Morten Rasmussen <> | Subject | [RFCv3 PATCH 39/48] sched: Introduce energy awareness into update_sg_lb_stats | Date | Wed, 4 Feb 2015 18:31:16 +0000 |
| |
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To be able to identify the least efficient (costliest) sched group introduce group_eff as the efficiency of the sched group into sg_lb_stats. The group efficiency is defined as the ratio between the group usage and the group energy consumption.
cc: Ingo Molnar <mingo@redhat.com> cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> --- kernel/sched/fair.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 45c784f..bfa335e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6345,6 +6345,7 @@ struct sg_lb_stats { unsigned long load_per_task; unsigned long group_capacity; unsigned long group_usage; /* Total usage of the group */ + unsigned long group_eff; unsigned int sum_nr_running; /* Nr tasks running in the group */ unsigned int idle_cpus; unsigned int group_weight; @@ -6715,6 +6716,21 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->group_no_capacity = group_is_overloaded(env, sgs); sgs->group_type = group_classify(env, group, sgs); + + if (env->use_ea) { + struct energy_env eenv = { + .sg_top = group, + .usage_delta = 0, + .src_cpu = -1, + .dst_cpu = -1, + }; + unsigned long group_energy = sched_group_energy(&eenv); + + if (group_energy) + sgs->group_eff = 1024*sgs->group_usage/group_energy; + else + sgs->group_eff = ULONG_MAX; + } } /** -- 1.9.1
|