capacity_of is 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 --- kernel/sched/fair.c | 7 +++++-- kernel/sched/sched.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 90b36cc..15f5638 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1018,7 +1018,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 */ @@ -2056,6 +2055,10 @@ 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); +#endif /* CONFIG_SMP */ + static void account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) { @@ -4132,7 +4135,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; } diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 04940f8..9a28d38 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -309,6 +309,8 @@ struct cfs_bandwidth { };
#endif /* CONFIG_CGROUP_SCHED */
+extern unsigned long capacity_of(int cpu); + /* CFS-related fields in a runqueue */ struct cfs_rq { struct load_weight load;