Patch "sched/fair: Fix inaccurate tally of ttwu_move_affine" has been added to the 5.15-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: Fix inaccurate tally of ttwu_move_affine

to the 5.15-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-fix-inaccurate-tally-of-ttwu_move_affine.patch
and it can be found in the queue-5.15 subdirectory.

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



commit a33d1333acacce023c60a6d8208bcd0dc646f997
Author: Libo Chen <libo.chen@xxxxxxxxxx>
Date:   Wed Aug 10 15:33:13 2022 -0700

    sched/fair: Fix inaccurate tally of ttwu_move_affine
    
    [ Upstream commit 39afe5d6fc59237ff7738bf3ede5a8856822d59d ]
    
    There are scenarios where non-affine wakeups are incorrectly counted as
    affine wakeups by schedstats.
    
    When wake_affine_idle() returns prev_cpu which doesn't equal to
    nr_cpumask_bits, it will slip through the check: target == nr_cpumask_bits
    in wake_affine() and be counted as if target == this_cpu in schedstats.
    
    Replace target == nr_cpumask_bits with target != this_cpu to make sure
    affine wakeups are accurately tallied.
    
    Fixes: 806486c377e33 (sched/fair: Do not migrate if the prev_cpu is idle)
    Suggested-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>
    Signed-off-by: Libo Chen <libo.chen@xxxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Reviewed-by: Gautham R. Shenoy <gautham.shenoy@xxxxxxx>
    Link: https://lore.kernel.org/r/20220810223313.386614-1-libo.chen@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2dd67e212f0ac..646a6ae4b2509 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6207,7 +6207,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p,
 		target = wake_affine_weight(sd, p, this_cpu, prev_cpu, sync);
 
 	schedstat_inc(p->stats.nr_wakeups_affine_attempts);
-	if (target == nr_cpumask_bits)
+	if (target != this_cpu)
 		return prev_cpu;
 
 	schedstat_inc(sd->ttwu_move_affine);



[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