]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/fair: Fix sched_avg fold
authorPeter Zijlstra <peterz@infradead.org>
Fri, 19 Dec 2025 08:04:45 +0000 (09:04 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 19 Dec 2025 08:09:38 +0000 (09:09 +0100)
After the robot reported a regression wrt commit: 089d84203ad4 ("sched/fair:
Fold the sched_avg update"), Shrikanth noted that two spots missed a factor
se_weight().

Fixes: 089d84203ad4 ("sched/fair: Fold the sched_avg update")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202512181208.753b9f6e-lkp@intel.com
Debugged-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251218102020.GO3707891@noisy.programming.kicks-ass.net
kernel/sched/fair.c

index 76f5e4b78b3069909169ac683cd8c181944ec003..7377f91175010b4ed3afcbc82b365aaa1242de96 100644 (file)
@@ -3775,13 +3775,15 @@ account_entity_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
 static inline void
 enqueue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-       __update_sa(&cfs_rq->avg, load, se->avg.load_avg, se->avg.load_sum);
+       __update_sa(&cfs_rq->avg, load, se->avg.load_avg,
+                   se_weight(se) * se->avg.load_sum);
 }
 
 static inline void
 dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-       __update_sa(&cfs_rq->avg, load, -se->avg.load_avg, -se->avg.load_sum);
+       __update_sa(&cfs_rq->avg, load, -se->avg.load_avg,
+                   se_weight(se) * -se->avg.load_sum);
 }
 
 static void place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags);