[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7363e7bd-942e-4e6e-9147-86b620a62120@amd.com>
Date: Wed, 29 Oct 2025 09:30:06 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: "Chen, Yu C" <yu.c.chen@...el.com>
CC: Vincent Guittot <vincent.guittot@...aro.org>, Juri Lelli
<juri.lelli@...hat.com>, 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>, "Madadi Vineeth
Reddy" <vineethr@...ux.ibm.com>, Hillf Danton <hdanton@...a.com>, "Shrikanth
Hegde" <sshegde@...ux.ibm.com>, Jianyong Wu <jianyong.wu@...look.com>,
"Yangyu Chen" <cyy@...self.name>, Tingyin Duan <tingyin.duan@...il.com>, Vern
Hao <vernhao@...cent.com>, Len Brown <len.brown@...el.com>, Aubrey Li
<aubrey.li@...el.com>, Zhao Liu <zhao1.liu@...el.com>, Chen Yu
<yu.chen.surf@...il.com>, Adam Li <adamli@...amperecomputing.com>, Tim Chen
<tim.c.chen@...el.com>, <linux-kernel@...r.kernel.org>, Tim Chen
<tim.c.chen@...ux.intel.com>, Peter Zijlstra <peterz@...radead.org>, "Ingo
Molnar" <mingo@...hat.com>, "Gautham R . Shenoy" <gautham.shenoy@....com>
Subject: Re: [PATCH 07/19] sched/fair: Track LLC-preferred tasks per runqueue
Hello Chenyu,
On 10/28/2025 8:45 PM, Chen, Yu C wrote:
>> Instead of relying on reset_llc_stats() hack, I think a better approach
>> would be to have a "p->se.llc_sched_active" flag similar to how uclamp
>> has "uc_se->active" and we set this in account_llc_enqueue() which will
>> still check for sched_cache_enabled() but account_llc_dequeue() would
>> only check for "p->se.llc_sched_active" to decrement the stats and then
>> unset the flag.
>>
>> That way, we cannot have an imbalanced accounting. Thoughts?
>>
>
> I suppose what you mean is to avoid the race condition between
> enabling sched_cache and EQ/DE_LLC, similar to uclamp:
>
> enqueue(taskA)
> // sched_cache gets enabled
> enqueue(taskB)
> dequeue(taskA)
> // Must not decrement rq->llc_pref for taskA
> dequeue(taskB)
Yup! We can have
enqueue(p)
account_llc_enqueue(p)
if (sched_cache_enabled())
p->se.llc_sched_active = true;
rq->nr_llc_running += (p->preferred_llc != -1);
rq->nr_pref_llc_running += (p->preferred_llc == task_llc(p));
...
dequeue(p)
account_llc_dequeue(p)
if (p->se.llc_sched_active)
rq->nr_llc_running -= (p->preferred_llc != -1);
rq->nr_pref_llc_running -= (p->preferred_llc == task_llc(p));
We can also have a single bit for "llc_sched_active" in the
task_struct next to the "sched_task_hot" bit instead of using the
hole in sched_entity after "sched_delayed"
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists