[PATCH v2 07/11] sched: clean up weighted_cpuload

From: Alex Shi
Date: Sun Feb 16 2014 - 20:57:20 EST


weighted_cpuload is used instead of source_load() when !idx.
Now idx is always 0. so unify the usage to soruce_load. That make
code more readable.

Signed-off-by: Alex Shi <alex.shi@xxxxxxxxxx>
---
kernel/sched/fair.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2da0e3b..5cdc838 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1045,7 +1045,7 @@ static void update_numa_stats(struct numa_stats *ns, int nid)
struct rq *rq = cpu_rq(cpu);

ns->nr_running += rq->nr_running;
- ns->load += weighted_cpuload(cpu);
+ ns->load += source_load(cpu);
ns->power += power_of(cpu);

cpus++;
@@ -3940,7 +3940,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)

#ifdef CONFIG_SMP
/* Used instead of source_load when we know the type == 0 */
-static unsigned long weighted_cpuload(const int cpu)
+static inline unsigned long weighted_cpuload(const int cpu)
{
return cpu_rq(cpu)->cfs.runnable_load_avg;
}
@@ -4324,7 +4324,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)

/* Traverse only the allowed CPUs */
for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) {
- load = weighted_cpuload(i);
+ load = source_load(i);

if (load < min_load || (load == min_load && i == this_cpu)) {
min_load = load;
@@ -5762,7 +5762,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
sgs->nr_numa_running += rq->nr_numa_running;
sgs->nr_preferred_running += rq->nr_preferred_running;
#endif
- sgs->sum_weighted_load += weighted_cpuload(i);
+ sgs->sum_weighted_load += source_load(i);
if (idle_cpu(i))
sgs->idle_cpus++;
}
@@ -6248,10 +6248,10 @@ static struct rq *find_busiest_queue(struct lb_env *env,
if (!capacity)
capacity = fix_small_capacity(env->sd, group);

- wl = weighted_cpuload(i);
+ wl = source_load(i);

/*
- * When comparing with imbalance, use weighted_cpuload()
+ * When comparing with imbalance, use source_load()
* which is not scaled with the cpu power.
*/
if (capacity && rq->nr_running == 1 && wl > env->imbalance)
@@ -6259,7 +6259,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,

/*
* For the load comparisons with the other cpu's, consider
- * the weighted_cpuload() scaled with the cpu power, so that
+ * the source_load() scaled with the cpu power, so that
* the load can be moved away from the cpu that is potentially
* running at a lower capacity.
*
--
1.8.1.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/