[PATCH RFC 3/7] sched: fair: add usage_util_of helper

From: Mike Turquette
Date: Wed Oct 22 2014 - 02:08:43 EST


Signed-off-by: Mike Turquette <mturquette@xxxxxxxxxx>
---
kernel/sched/fair.c | 6 ++++++
kernel/sched/sched.h | 1 +
2 files changed, 7 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 15f5638..0930ad8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2057,6 +2057,7 @@ static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p)

#ifdef CONFIG_SMP
unsigned long capacity_of(int cpu);
+unsigned long usage_util_of(int cpu);
#endif /* CONFIG_SMP */

static void
@@ -4140,6 +4141,11 @@ unsigned long capacity_of(int cpu)
return cpu_rq(cpu)->cpu_capacity;
}

+unsigned long usage_util_of(int cpu)
+{
+ return cpu_rq(cpu)->cfs.usage_util_avg;
+}
+
static unsigned long cpu_avg_load_per_task(int cpu)
{
struct rq *rq = cpu_rq(cpu);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 9a28d38..c34cbfc 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -310,6 +310,7 @@ struct cfs_bandwidth { };
#endif /* CONFIG_CGROUP_SCHED */

extern unsigned long capacity_of(int cpu);
+extern unsigned long usage_util_of(int cpu);

/* CFS-related fields in a runqueue */
struct cfs_rq {
--
1.8.3.2

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