Skip to content

Commit 7c7ad62

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/fair: Keep load_avg and load_sum synced
when removing a cfs_rq from the list we only check _sum value so we must ensure that _avg and _sum stay synced so load_sum can't be null whereas load_avg is not after propagating load in the cgroup hierarchy. Use load_avg to compute load_sum similarly to what is done for util_sum and runnable_sum. Fixes: 0e2d2aa ("sched/fair: Rewrite PELT migration propagation") Reported-by: Odin Ugedal <[email protected]> Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Odin Ugedal <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 8124c8a commit 7c7ad62

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

kernel/sched/fair.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,10 +3499,9 @@ update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cf
34993499
static inline void
35003500
update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq)
35013501
{
3502-
long delta_avg, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum;
3502+
long delta, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum;
35033503
unsigned long load_avg;
35043504
u64 load_sum = 0;
3505-
s64 delta_sum;
35063505
u32 divider;
35073506

35083507
if (!runnable_sum)
@@ -3549,13 +3548,13 @@ update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq
35493548
load_sum = (s64)se_weight(se) * runnable_sum;
35503549
load_avg = div_s64(load_sum, divider);
35513550

3552-
delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum;
3553-
delta_avg = load_avg - se->avg.load_avg;
3551+
delta = load_avg - se->avg.load_avg;
35543552

35553553
se->avg.load_sum = runnable_sum;
35563554
se->avg.load_avg = load_avg;
3557-
add_positive(&cfs_rq->avg.load_avg, delta_avg);
3558-
add_positive(&cfs_rq->avg.load_sum, delta_sum);
3555+
3556+
add_positive(&cfs_rq->avg.load_avg, delta);
3557+
cfs_rq->avg.load_sum = cfs_rq->avg.load_avg * divider;
35593558
}
35603559

35613560
static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum)

0 commit comments

Comments
 (0)