[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230811094806.GB399195@ziqianlu-dell>
Date: Fri, 11 Aug 2023 17:48:06 +0800
From: Aaron Lu <aaron.lu@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Daniel Jordan <daniel.m.jordan@...cle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
"Mel Gorman" <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Tim Chen <tim.c.chen@...el.com>,
Nitin Tekchandani <nitin.tekchandani@...el.com>,
Yu Chen <yu.c.chen@...el.com>,
Waiman Long <longman@...hat.com>,
<linux-kernel@...r.kernel.org>, <yury.norov@...il.com>,
<andriy.shevchenko@...ux.intel.com>, <linux@...musvillemoes.dk>,
<rppt@...nel.org>
Subject: Re: [RFC PATCH 2/4] sched/fair: Make tg->load_avg per node
On Wed, Aug 02, 2023 at 01:28:36PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 19, 2023 at 09:45:00PM +0800, Aaron Lu wrote:
> > On Wed, Jul 19, 2023 at 01:53:58PM +0200, Peter Zijlstra wrote:
> > > On Tue, Jul 18, 2023 at 09:41:18PM +0800, Aaron Lu wrote:
> > > > +#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
> > > > +static inline long tg_load_avg(struct task_group *tg)
> > > > +{
> > > > + long load_avg = 0;
> > > > + int i;
> > > > +
> > > > + /*
> > > > + * The only path that can give us a root_task_group
> > > > + * here is from print_cfs_rq() thus unlikely.
> > > > + */
> > > > + if (unlikely(tg == &root_task_group))
> > > > + return 0;
> > > > +
> > > > + for_each_node(i)
> > > > + load_avg += atomic_long_read(&tg->node_info[i]->load_avg);
> > > > +
> > > > + return load_avg;
> > > > +}
> > > > +#endif
> > >
> > > So I was working on something else numa and noticed that for_each_node()
> > > (and most of the nodemask stuff) is quite moronic, afaict we should do
> > > something like the below.
> > >
> > > I now see Mike added the nr_node_ids thing fairly recent, but given
> > > distros have NODES_SHIFT=10 and actual machines typically only have <=4
> > > nodes, this would save a factor of 256 scanning.
>
> More complete nodemask patch here:
>
> https://lkml.kernel.org/r/20230802112458.230221601%40infradead.org
Thanks for the update.
I incorperated this numa change and collected some data and found that
with the newly proposed approach to rate limit updates to tg->load_avg
to at most once per ms, the cost of accessing tg->load_avg is dropped
so much that adding other optimizations doesn't make much difference.
So I was thinking maybe I just need that one ratelimit patch to reduce
the cost of accessing tg->load_avg. The detailed data is here:
https://lore.kernel.org/lkml/20230811092811.GA399195@ziqianlu-dell/
Powered by blists - more mailing lists