]> git.baikalelectronics.ru Git - kernel.git/commit
sched/fair: Fix inaccurate tally of ttwu_move_affine
authorLibo Chen <libo.chen@oracle.com>
Wed, 10 Aug 2022 22:33:13 +0000 (15:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:31 +0000 (23:03 +0900)
commitf8bbb66c28e7fa0e858042222c969d7c51da981a
treefd6057fbc2098925b2e104f0663352036912039f
parent8dbee699205b9eacb588ed64d915c7fa343870f7
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: 1cbb9ec1cf9e0 (sched/fair: Do not migrate if the prev_cpu is idle)
Suggested-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Libo Chen <libo.chen@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Link: https://lore.kernel.org/r/20220810223313.386614-1-libo.chen@oracle.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/fair.c