[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <168077551915.404.18277041961422238219.tip-bot2@tip-bot2>
Date: Thu, 06 Apr 2023 10:05:19 -0000
From: "tip-bot2 for Libo Chen" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Daniel Jordan <daniel.m.jordan@...cle.com>,
Libo Chen <libo.chen@...cle.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
"Gautham R. Shenoy" <gautham.shenoy@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/fair: Fix inaccurate tally of ttwu_move_affine
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 39afe5d6fc59237ff7738bf3ede5a8856822d59d
Gitweb: https://git.kernel.org/tip/39afe5d6fc59237ff7738bf3ede5a8856822d59d
Author: Libo Chen <libo.chen@...cle.com>
AuthorDate: Wed, 10 Aug 2022 15:33:13 -07:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 05 Apr 2023 09:58:48 +02:00
sched/fair: Fix inaccurate tally of ttwu_move_affine
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@...cle.com>
Signed-off-by: Libo Chen <libo.chen@...cle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@....com>
Link: https://lore.kernel.org/r/20220810223313.386614-1-libo.chen@oracle.com
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bc358dc..f5da01a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6582,7 +6582,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);
Powered by blists - more mailing lists