[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250316102916.10614-4-kprateek.nayak@amd.com>
Date: Sun, 16 Mar 2025 10:29:13 +0000
From: K Prateek Nayak <kprateek.nayak@....com>
To: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot
<vincent.guittot@...aro.org>, Chen Yu <yu.c.chen@...el.com>,
<linux-kernel@...r.kernel.org>
CC: Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt
<rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman
<mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>, David Vernet
<void@...ifault.com>, "Gautham R. Shenoy" <gautham.shenoy@....com>, "Swapnil
Sapkal" <swapnil.sapkal@....com>, Shrikanth Hegde <sshegde@...ux.ibm.com>, "K
Prateek Nayak" <kprateek.nayak@....com>
Subject: [RFC PATCH 12/08] sched/fair: Record the cpu that updated the stats last
Record which CPU updated the stats last. This will be used to invalidate
the stats in the following commits.
Signed-off-by: K Prateek Nayak <kprateek.nayak@....com>
---
kernel/sched/fair.c | 5 +++--
kernel/sched/sched.h | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6c486e194a9d..2a34d73d824b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10279,9 +10279,9 @@ static inline void cache_sd_stats(struct lb_env *env, struct sg_lb_stats *sd_sta
{
struct sched_domain_shared *sd_share = env->sd->shared;
struct sg_lb_stats_prop *lb_prop;
- int cpu, retry_limit = 3;
u64 time, lock;
long version;
+ int cpu;
if (!sd_share)
return;
@@ -10319,7 +10319,7 @@ static inline void cache_sd_stats(struct lb_env *env, struct sg_lb_stats *sd_sta
* Version is up for grabs! Try again. If the CPU grabs
* the lock next time around lock = version = 0 and this
* is skipped. If it cannot grab the version, lock != 0
- * and we return from here thus ensuring on a single
+ * and we return from here thus ensuring only a single
* retry.
*/
if (!lock) {
@@ -10330,6 +10330,7 @@ static inline void cache_sd_stats(struct lb_env *env, struct sg_lb_stats *sd_sta
}
lb_prop->sg_stats = *sd_stats;
+ lb_prop->update_cpu = cpu;
/*
* Pairs against readers checking the version
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 64f7e013fd59..adf4fa2ed031 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2197,6 +2197,7 @@ struct sg_lb_stats_prop {
*/
atomic_long_t version;
struct sg_lb_stats sg_stats; /* Cached sched_group stats */
+ int update_cpu; /* CPU that updated the stats */
};
static inline struct cpumask *sched_group_span(struct sched_group *sg)
--
2.43.0
Powered by blists - more mailing lists