mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Waiman Long <llong@redhat.com>,
	Swapnil Sapkal <swapnil.sapkal@amd.com>,
	"Dhananjay Ugwekar" <Dhananjay.Ugwekar@amd.com>,
	Huang Rui <ray.huang@amd.com>, "Perry Yuan" <perry.yuan@amd.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>
Subject: [PATCH v2 1/4] sched/fair: Use READ_ONCE() to read sg->asym_prefer_cpu
Date: Wed, 9 Apr 2025 05:34:43 +0000	[thread overview]
Message-ID: <20250409053446.23367-2-kprateek.nayak@amd.com> (raw)
In-Reply-To: <20250409053446.23367-1-kprateek.nayak@amd.com>

Subsequent commits add the support to dynamically update the sched_group
struct's "asym_prefer_cpu" member from a remote CPU. Use READ_ONCE()
when reading the "sg->asym_prefer_cpu" to ensure load balancer always
reads the latest value.

Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
---
 kernel/sched/fair.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0c19459c8042..5e1bd9e8464c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10251,7 +10251,7 @@ sched_group_asym(struct lb_env *env, struct sg_lb_stats *sgs, struct sched_group
 	    (sgs->group_weight - sgs->idle_cpus != 1))
 		return false;
 
-	return sched_asym(env->sd, env->dst_cpu, group->asym_prefer_cpu);
+	return sched_asym(env->sd, env->dst_cpu, READ_ONCE(group->asym_prefer_cpu));
 }
 
 /* One group has more than one SMT CPU while the other group does not */
@@ -10488,7 +10488,8 @@ static bool update_sd_pick_busiest(struct lb_env *env,
 
 	case group_asym_packing:
 		/* Prefer to move from lowest priority CPU's work */
-		return sched_asym_prefer(sds->busiest->asym_prefer_cpu, sg->asym_prefer_cpu);
+		return sched_asym_prefer(READ_ONCE(sds->busiest->asym_prefer_cpu),
+					 READ_ONCE(sg->asym_prefer_cpu));
 
 	case group_misfit_task:
 		/*
-- 
2.34.1


  reply	other threads:[~2025-04-09  5:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  5:34 [PATCH v2 0/4] sched/fair: Dynamic asym priority support K Prateek Nayak
2025-04-09  5:34 ` K Prateek Nayak [this message]
2025-04-16 19:16   ` [tip: sched/core] sched/fair: Use READ_ONCE() to read sg->asym_prefer_cpu tip-bot2 for K Prateek Nayak
2025-04-09  5:34 ` [PATCH v2 2/4] sched/topology: Introduce sched_update_asym_prefer_cpu() K Prateek Nayak
2025-04-16 19:16   ` [tip: sched/core] " tip-bot2 for K Prateek Nayak
2025-04-09  5:34 ` [PATCH v2 3/4] cpufreq/amd-pstate: Update asym_prefer_cpu when core rankings change K Prateek Nayak
2025-04-09 19:15   ` Mario Limonciello
2025-04-16 19:16   ` [tip: sched/core] " tip-bot2 for K Prateek Nayak
2025-04-09  5:34 ` [PATCH v2 4/4] sched/debug: Print the local group's asym_prefer_cpu K Prateek Nayak
2025-04-16 19:16   ` [tip: sched/core] " tip-bot2 for K Prateek Nayak
2025-04-10 10:52 ` [PATCH v2 0/4] sched/fair: Dynamic asym priority support Peter Zijlstra
2025-04-10 15:40   ` K Prateek Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250409053446.23367-2-kprateek.nayak@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=Dhananjay.Ugwekar@amd.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gautham.shenoy@amd.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llong@redhat.com \
    --cc=mario.limonciello@amd.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=perry.yuan@amd.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=rostedt@goodmis.org \
    --cc=swapnil.sapkal@amd.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®