From: Valentin Schneider <valentin.schneider@arm.com>
To: Beata Michalska <beata.michalska@arm.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
corbet@lwn.net, rdunlap@infradead.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v4 2/3] sched/topology: Rework CPU capacity asymmetry detection
Date: Tue, 18 May 2021 16:53:54 +0100 [thread overview]
Message-ID: <87bl9811il.mognet@arm.com> (raw)
In-Reply-To: <20210518144033.GB3993@e120325.cambridge.arm.com>
On 18/05/21 15:40, Beata Michalska wrote:
> On Mon, May 17, 2021 at 04:06:05PM +0100, Valentin Schneider wrote:
>> On 17/05/21 14:18, Beata Michalska wrote:
>> > On Mon, May 17, 2021 at 01:04:25PM +0100, Valentin Schneider wrote:
>> >> On 17/05/21 09:23, Beata Michalska wrote:
>> >> > +static void asym_cpu_capacity_scan(const struct cpumask *cpu_map)
>> >> > +{
>> >> > + struct asym_cap_data *entry, *next;
>> >> > + int cpu;
>> >> >
>> >> > - for_each_sd_topology(tl) {
>> >> > - if (tl_id < asym_level)
>> >> > - goto next_level;
>> >> > + if (!list_empty(&asym_cap_list))
>> >> > + list_for_each_entry(entry, &asym_cap_list, link)
>> >> > + cpumask_clear(entry->cpu_mask);
>> >> >
>> >>
>> >> The topology isn't going to change between domain rebuilds, so why
>> >> recompute the masks? The sched_domain spans are already masked by cpu_map,
>> >> so no need to do this masking twice. I'm thinking this scan should be done
>> >> once against the cpu_possible_mask - kinda like sched_init_numa() done once
>> >> against the possible nodes.
>> >>
>> > This is currently done, as what you have mentioned earlier, the tl->mask
>> > may contain CPUs that are not 'available'. So it makes sure that the masks
>> > kept on the list are representing only those CPUs that are online.
>> > And it is also needed case all CPUs of given capacity go offline - not to to
>> > lose the full asymmetry that might change because of that ( empty masks are
>> > being removed from the list).
>> >
>> > I could change that and use the CPU mask that represents the online CPUs as
>> > a checkpoint but then it also means additional tracking which items on the
>> > list are actually available at a given point of time.
>> > So if the CPUs masks on the list are to be set once (as you are suggesting)
>> > than it needs additional logic to count the number of available capacities
>> > to decide whether there is a full asymmetry or not.
>> >
>>
>> That should be doable by counting non-empty intersections between each
>> entry->cpumask and the cpu_online_mask in _classify().
>>
>> That said I'm afraid cpufreq module loading forces us to dynamically update
>> those masks, as you've done. The first domain build could see asymmetry
>> without cpufreq loaded, and a later one with cpufreq loaded would need an
>> update. Conversely, as much of a fringe case as it is, we'd have to cope
>> with the cpufreq module being unloaded later on...
>>
>> :(
> So it got me thinking that maybe we could actually make it more
> 'update-on-demand' and use the cpufreq policy notifier to trigger the update.
> I could try to draft smth generic enough to make it ... relatively easy to adapt
> to different archs case needed.
> Any thoughts ?
>
The cpufreq policy notifier rebuild is currently an arch_topology.c
specificity, and perhaps we can consider this as our standing policy: if an
arch needs a topology rebuild upon X event (which isn't hotplug), it is
responsible for triggering it itself.
There's those sched_energy_update / arch_update_cpu_topology() bools that
are used to tweak the rebuild behaviour, perhaps you could gate the
capacity maps rebuild behind arch_update_cpu_topology()?
That way you could build those maps based on a cpu_possible_mask iterator,
and only rebuild them when the arch requests it (arch_topology already does
that with the cpufreq notifier). How does it sound?
> ---
> BR
> B.
next prev parent reply other threads:[~2021-05-18 15:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 8:23 [PATCH v4 0/3] Rework CPU capacity asymmetry detection Beata Michalska
2021-05-17 8:23 ` [PATCH v4 1/3] sched/core: Introduce SD_ASYM_CPUCAPACITY_FULL sched_domain flag Beata Michalska
2021-05-18 13:39 ` Vincent Guittot
2021-05-18 14:27 ` Beata Michalska
2021-05-18 14:53 ` Vincent Guittot
2021-05-18 15:09 ` Beata Michalska
2021-05-18 15:28 ` Vincent Guittot
2021-05-18 15:47 ` Beata Michalska
2021-05-18 15:56 ` Vincent Guittot
2021-05-18 16:34 ` Beata Michalska
2021-05-17 8:23 ` [PATCH v4 2/3] sched/topology: Rework CPU capacity asymmetry detection Beata Michalska
2021-05-17 12:04 ` Valentin Schneider
2021-05-17 13:18 ` Beata Michalska
2021-05-17 15:06 ` Valentin Schneider
2021-05-18 14:40 ` Beata Michalska
2021-05-18 15:53 ` Valentin Schneider [this message]
2021-05-18 17:10 ` Beata Michalska
2021-05-19 11:30 ` Peter Zijlstra
2021-05-19 19:48 ` Beata Michalska
2021-05-17 8:23 ` [PATCH v4 3/3] sched/doc: Update the CPU capacity asymmetry bits Beata Michalska
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=87bl9811il.mognet@arm.com \
--to=valentin.schneider@arm.com \
--cc=beata.michalska@arm.com \
--cc=corbet@lwn.net \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=vincent.guittot@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).