Patch "sched/fair: Ensure _sum and _avg values stay consistent" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched/fair: Ensure _sum and _avg values stay consistent

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched-fair-ensure-_sum-and-_avg-values-stay-consiste.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1d1ea92e3af733f0c41e47594d507a815a871a71
Author: Odin Ugedal <odin@xxxxxxx>
Date:   Thu Jun 24 13:18:15 2021 +0200

    sched/fair: Ensure _sum and _avg values stay consistent
    
    [ Upstream commit 1c35b07e6d3986474e5635be566e7bc79d97c64d ]
    
    The _sum and _avg values are in general sync together with the PELT
    divider. They are however not always completely in perfect sync,
    resulting in situations where _sum gets to zero while _avg stays
    positive. Such situations are undesirable.
    
    This comes from the fact that PELT will increase period_contrib, also
    increasing the PELT divider, without updating _sum and _avg values to
    stay in perfect sync where (_sum == _avg * divider). However, such PELT
    change will never lower _sum, making it impossible to end up in a
    situation where _sum is zero and _avg is not.
    
    Therefore, we need to ensure that when subtracting load outside PELT,
    that when _sum is zero, _avg is also set to zero. This occurs when
    (_sum < _avg * divider), and the subtracted (_avg * divider) is bigger
    or equal to the current _sum, while the subtracted _avg is smaller than
    the current _avg.
    
    Reported-by: Sachin Sant <sachinp@xxxxxxxxxxxxxxxxxx>
    Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
    Signed-off-by: Odin Ugedal <odin@xxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Reviewed-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
    Tested-by: Sachin Sant <sachinp@xxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210624111815.57937-1-odin@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3d92de7909bf..32c0905bca84 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3672,15 +3672,15 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)
 
 		r = removed_load;
 		sub_positive(&sa->load_avg, r);
-		sub_positive(&sa->load_sum, r * divider);
+		sa->load_sum = sa->load_avg * divider;
 
 		r = removed_util;
 		sub_positive(&sa->util_avg, r);
-		sub_positive(&sa->util_sum, r * divider);
+		sa->util_sum = sa->util_avg * divider;
 
 		r = removed_runnable;
 		sub_positive(&sa->runnable_avg, r);
-		sub_positive(&sa->runnable_sum, r * divider);
+		sa->runnable_sum = sa->runnable_avg * divider;
 
 		/*
 		 * removed_runnable is the unweighted version of removed_load so we



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux