[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88cc1be4cbcab6d52172cbbf74fdd063c5e93d98.camel@linux.intel.com>
Date: Tue, 09 Dec 2025 14:55:21 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>, K Prateek Nayak
<kprateek.nayak@....com>, "Gautham R . Shenoy" <gautham.shenoy@....com>,
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>, Vern Hao
<haoxing990@...il.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>, Chen Yu <yu.c.chen@...el.com>, Adam Li
<adamli@...amperecomputing.com>, Aaron Lu <ziqianlu@...edance.com>, Tim
Chen <tim.c.chen@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 06/23] sched/cache: Track LLC-preferred tasks per
runqueue
On Tue, 2025-12-09 at 13:16 +0100, Peter Zijlstra wrote:
> On Wed, Dec 03, 2025 at 03:07:25PM -0800, Tim Chen wrote:
>
>
> > #ifdef CONFIG_SCHED_CACHE
> > struct callback_head cache_work;
> > + /*the p is currently refcounted in a rq's preferred llc stats*/
>
> Shall we have spaces after and before the comment marks?
>
> Also, comment confuses me, I don't see get_task_struct() /
> put_task_struct() usage. Did you mean something else with refcount?
It is the accounting for number of tasks preferring
a certain LLC on a runqueue during enqueue/dequeue,
or when a task's LLC preference changes, by
account_llc_enqueue() and account_llc_dequeue()
How about change he comment to
/* LLC preference accounting should be done in dequeue */
>
> > + bool sched_llc_active;
> > int preferred_llc;
> > #endif
>
> > +static void account_llc_dequeue(struct rq *rq, struct task_struct *p)
> > +{
> > + int pref_llc;
> > +
> > + /*
> > + * Borrow the uc_se->active from uclamp_rq_inc_id(),
> > + * uclamp_rq_dec_id() to avoid the unbalanced calculation
> > + * of rq statistics.
> > + */
> > + if (unlikely(!p->sched_llc_active))
> > + return;
>
> Another very confusing comment; what? Also, can you please explain (in
> the new comment) how we get here without having llc_active set?
The comment meant to say that we are using a similar mechanism as
accounting done in uc_se->active from uclamp_rq_inc_id(). I agree that
it confuses more than making things clearer.
How about the following comment to make things clearer:
/*
* Cache aware scheduling was active when the task was enqueued.
* Admin has disabled cache aware scheduling before task was dequeued
* but the accounting has to be kept straight in case cache aware scheduling
* is re-enabled.
*/
>
> > +
> > + pref_llc = p->preferred_llc;
> > + if (pref_llc < 0)
> > + return;
> > +
> > + rq->nr_llc_running--;
> > + rq->nr_pref_llc_running -= (pref_llc == task_llc(p));
> > + p->sched_llc_active = false;
> > +}
Powered by blists - more mailing lists