[PATCH] sched/fair: use user weight to calculate util_avg in post_init_entity_util_avg()

From: T.Zhou
Date: Wed Dec 07 2016 - 20:26:36 EST


To calculate util_avg, se's weight should have the
same resolution as cfs->avg.load_avg. So use user
weight instead.

Signed-off-by: T.Zhou <t1zhou@xxxxxxx>
---
kernel/sched/fair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 18d9e75..9799438 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -792,7 +792,8 @@ void post_init_entity_util_avg(struct sched_entity *se)

if (cap > 0) {
if (cfs_rq->avg.util_avg != 0) {
- sa->util_avg = cfs_rq->avg.util_avg * se->load.weight;
+ sa->util_avg = cfs_rq->avg.util_avg *
+ scale_load_down(se->load.weight);
sa->util_avg /= (cfs_rq->avg.load_avg + 1);

if (sa->util_avg > cap)
--
2.7.3