Skip to contentSkip to conversation

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

PATCH New T.Zhou 1 participant 1 message Dec 8, 2016 Scheduler

lore
Share & tools
lore

T.Zhou

author
#0 lore raw

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

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

---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index 18d9e75..9799438 100644
@@ -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)
Signature · 1 line
2.7.3