summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2014-10-21 23:07:26 -0700
committerMichael Turquette <mturquette@deferred.io>2014-11-19 01:36:40 -0800
commit53a2bf2f1c10448ea885318e83ae7f72f34e4b2d (patch)
tree24a899e2892a7454a960d3b370f223817fb1c495
parent5986fc8957ea0f3ba5ba53a9fe95d2105d5a3c9e (diff)
sched: cfs: declare capacity_of & get_cpu_usage in sched.h
capacity_of and get_cpu_usage useful for cpu frequency scaling policies. Share it via sched.h so that selectable cpu frequency scaling policies can make use of it. Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r--kernel/sched/fair.c10
-rw-r--r--kernel/sched/sched.h3
2 files changed, 10 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8a2e363a8a0b..a6e7beec3b27 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1108,7 +1108,6 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
static unsigned long weighted_cpuload(const int cpu);
static unsigned long source_load(int cpu, int type);
static unsigned long target_load(int cpu, int type);
-static unsigned long capacity_of(int cpu);
static long effective_load(struct task_group *tg, int cpu, long wl, long wg);
/* Cached statistics for all CPUs within a node */
@@ -2261,6 +2260,11 @@ static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p)
}
#endif /* CONFIG_NUMA_BALANCING */
+#ifdef CONFIG_SMP
+unsigned long capacity_of(int cpu);
+//unsigned long usage_util_of(int cpu);
+#endif /* CONFIG_SMP */
+
static void
account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
{
@@ -4340,7 +4344,7 @@ static unsigned long target_load(int cpu, int type)
return max(rq->cpu_load[type-1], total);
}
-static unsigned long capacity_of(int cpu)
+unsigned long capacity_of(int cpu)
{
return cpu_rq(cpu)->cpu_capacity;
}
@@ -4780,7 +4784,7 @@ done:
* Without capping the usage, a group could be seen as overloaded (CPU0 usage
* at 121% + CPU1 usage at 80%) whereas CPU1 has 20% of available capacity/
*/
-static int get_cpu_usage(int cpu)
+int get_cpu_usage(int cpu)
{
unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg;
unsigned long capacity = capacity_orig_of(cpu);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index d4c580f7f12c..770c18cd6bee 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -332,6 +332,9 @@ struct cfs_bandwidth { };
#endif /* CONFIG_CGROUP_SCHED */
+extern unsigned long capacity_of(int cpu);
+extern int get_cpu_usage(int cpu);
+
/* CFS-related fields in a runqueue */
struct cfs_rq {
struct load_weight load;