mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
@ 2026-11-27  9:11 Li kunyu
  2026-11-27  9:33 ` Kayra Cizmeci
  2026-11-27 11:00 ` [PATCH v2] " Li kunyu
  0 siblings, 2 replies; 6+ messages in thread
From: Li kunyu @ 2026-11-27  9:11 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	kayracizmeci
  Cc: linux-kernel, Li kunyu

pref_llc_queued is only used once. Assign p->pref_llc_queued directly
at the original sampling point instead of caching the value in a local
variable.

Suggested-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://lore.kernel.org/all/awhlwJTOLPeNqFW8@scheduler.schedules/
Signed-off-by: Li kunyu <likunyu@open-hieco.net>
---
 kernel/sched/fair.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..4efc5ed5e79f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1521,16 +1521,13 @@ static void pref_llc_running_dec(struct rq *rq, struct task_struct *p)
 
 static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 {
-	int pref_llc, pref_llc_queued;
+	int pref_llc;
 	struct sched_domain *sd;
 
 	pref_llc = p->preferred_llc;
 	if (pref_llc < 0)
 		return;
 
-	pref_llc_queued = (pref_llc == task_llc(p));
-	rq->nr_llc_running++;
-
 	/*
 	 * Record whether p is enqueued on its preferred
 	 * LLC, in order to pair with account_llc_dequeue()
@@ -1545,7 +1542,8 @@ static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 	 * p->pref_llc_queued in account_llc_dequeue() would
 	 * be reliable.
 	 */
-	p->pref_llc_queued = pref_llc_queued;
+	p->pref_llc_queued = (pref_llc == task_llc(p));
+	rq->nr_llc_running++;
 
 	/* Skipped while delayed; clear_delayed() adds it back on wake. */
 	pref_llc_running_inc(rq, p);
-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-27 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  9:11 [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue() Li kunyu
2026-11-27  9:33 ` Kayra Cizmeci
2026-11-27  9:47   ` Li kunyu
2026-11-27 10:22     ` Kayra Cizmeci
2026-11-27 10:40       ` Li kunyu
2026-11-27 11:00 ` [PATCH v2] " Li kunyu

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®