From: Dietmar Eggemann <dietmar.eggem...@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 <mi...@redhat.com>
cc: Peter Zijlstra <pet...@infradead.org>

Signed-off-by: Dietmar Eggemann <dietmar.eggem...@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

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

Reply via email to