Skip to contentSkip to conversation

sched/fair: Fix rounding bug for asym packing

tip:sched/core Peter Zijlstra 2 participants 2 messages Jan 21, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Sorry guys, I seem to have messed this up :/

Valentin pointed me out that I missed v3 and v4 of these patches; v3 got lost in the x-mas pile and v4 was actually on my todo list for this week, but I'd forgotten I'd already queued v2.

I'll go queue delta patches.

Quoted 16 lines · tip-bot for Vincent Guittot

index 50aa2aba69bd..2ccd6e093326 100644

kernel/sched/fair.c +6 -0
@@ -8190,6 +8190,12 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 	/* Adjust by relative CPU capacity of the group */
 	sgs->group_capacity = group->sgc->capacity;
 	sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE) / sgs->group_capacity;
+	/*
+	 * Prevent division rounding to make the computation of imbalance
+	 * slightly less than original value and to prevent the rq to be then
+	 * selected as busiest queue:
+	 */
+	sgs->avg_load += 1;
 
 	if (sgs->sum_nr_running)
 		sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running;
#2 lore raw
Quoted 5 lines · Peter Zijlstra

Sorry guys, I seem to have messed this up :/

Valentin pointed me out that I missed v3 and v4 of these patches; v3 got

I was about to sent an email about that too

Quoted 4 lines

lost in the x-mas pile and v4 was actually on my todo list for this week, but I'd forgotten I'd already queued v2.

I'll go queue delta patches.

Thanks

Quoted 20 lines · tip-bot for Vincent Guittot
Quoted 16 lines

index 50aa2aba69bd..2ccd6e093326 100644

kernel/sched/fair.c +6 -0
@@ -8190,6 +8190,12 @@ static inline void update_sg_lb_stats(struct lb_env *env,
      /* Adjust by relative CPU capacity of the group */
      sgs->group_capacity = group->sgc->capacity;
      sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE) / sgs->group_capacity;
+     /*
+      * Prevent division rounding to make the computation of imbalance
+      * slightly less than original value and to prevent the rq to be then
+      * selected as busiest queue:
+      */
+     sgs->avg_load += 1;
 
      if (sgs->sum_nr_running)
              sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running;