[PATCH 08/16] sched: recover to whole rq load include rt tasks'

From: Alex Shi
Date: Mon Jun 24 2013 - 04:12:29 EST


patch 'sched: compute runnable load avg in cpu_load and
cpu_avg_load_per_task' weight rq's load on cfs.runnable_load_avg instead
of rq->load.weight. That is fine when system has no much RT load.

But if there are lots of RT load on rq, that code will just
weight the cfs tasks in load balance without consideration of RT, that
may cause load imbalance if much RT load isn't imbalanced among cpu.
Using rq->avg.load_avg_contrib can resolve this problem and keep the
advantages from runnable load balance.

BTW, this patch may increase the balance failed times, if move_tasks can
not balance loads between CPUs, like there is only RT load in CPUs.

Signed-off-by: Alex Shi <alex.shi@xxxxxxxxx>
---
kernel/sched/fair.c | 4 ++--
kernel/sched/proc.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 37a5720..6979906 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2968,7 +2968,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
/* Used instead of source_load when we know the type == 0 */
static unsigned long weighted_cpuload(const int cpu)
{
- return cpu_rq(cpu)->cfs.runnable_load_avg;
+ return cpu_rq(cpu)->avg.load_avg_contrib;
}

/*
@@ -3013,7 +3013,7 @@ static unsigned long cpu_avg_load_per_task(int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long nr_running = ACCESS_ONCE(rq->nr_running);
- unsigned long load_avg = rq->cfs.runnable_load_avg;
+ unsigned long load_avg = rq->avg.load_avg_contrib;

if (nr_running)
return load_avg / nr_running;
diff --git a/kernel/sched/proc.c b/kernel/sched/proc.c
index ce5cd48..4f2490c 100644
--- a/kernel/sched/proc.c
+++ b/kernel/sched/proc.c
@@ -504,7 +504,7 @@ static void __update_cpu_load(struct rq *this_rq, unsigned long this_load,
#ifdef CONFIG_SMP
unsigned long get_rq_runnable_load(struct rq *rq)
{
- return rq->cfs.runnable_load_avg;
+ return rq->avg.load_avg_contrib;
}
#else
unsigned long get_rq_runnable_load(struct rq *rq)
--
1.7.12


--
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/