Re: [PATCH v5 2/3] sched/topology: Rework CPU capacity asymmetry detection

From: Valentin Schneider
Date: Tue May 25 2021 - 05:53:36 EST


On 24/05/21 23:55, Beata Michalska wrote:
> On Mon, May 24, 2021 at 07:01:04PM +0100, Valentin Schneider wrote:
>> On 24/05/21 11:16, Beata Michalska wrote:
>> > This patch also removes the additional -dflags- parameter used when
>> ^^^^^^^^^^^^^^^^^^^^^^^
>> s/^/Also remove/
> I would kind of ... disagree.
> All the commit msg is constructed using passive structure, the suggestion
> would actually break that. And it does 'sound' bit imperative but I guess
> that is subjective. I'd rather stay with impersonal structure (which is
> applied through out the whole patchset).

It's mainly about the 'This patch' formulation, some take exception to that :-)

>>
>> > building sched domains as the asymmetry flags are now being set
>> > directly in sd_init.
>> >
>>
>> Few nits below, but beyond that:
>>
>> Tested-by: Valentin Schneider <valentin.schneider@xxxxxxx>
>> Reviewed-by: Valentin Schneider <valentin.schneider@xxxxxxx>
>>
> Thanks a lot for the review and testing!
>
>> > +static inline int
>> > +asym_cpu_capacity_classify(struct sched_domain *sd,
>> > + const struct cpumask *cpu_map)
>> > +{
>> > + int sd_asym_flags = SD_ASYM_CPUCAPACITY | SD_ASYM_CPUCAPACITY_FULL;
>> > + struct asym_cap_data *entry;
>> > + int asym_cap_count = 0;
>> > +
>> > + if (list_is_singular(&asym_cap_list))
>> > + goto leave;
>> > +
>> > + list_for_each_entry(entry, &asym_cap_list, link) {
>> > + if (cpumask_intersects(sched_domain_span(sd), entry->cpu_mask)) {
>> > + ++asym_cap_count;
>> > + } else {
>> > + /*
>> > + * CPUs with given capacity might be offline
>> > + * so make sure this is not the case
>> > + */
>> > + if (cpumask_intersects(entry->cpu_mask, cpu_map)) {
>> > + sd_asym_flags &= ~SD_ASYM_CPUCAPACITY_FULL;
>> > + if (asym_cap_count > 1)
>> > + break;
>> > + }
>>
>> Readability nit: That could be made into an else if ().
> It could but then this way the -comment- gets more exposed.
> But that might be my personal perception so I can change that.

As always those are quite subjective! Methink something like this would
still draw attention to the offline case:

/*
* Count how many unique capacities this domain covers. If a
* capacity isn't covered, we need to check if any CPU with
* that capacity is actually online, otherwise it can be
* ignored.
*/
if (cpumask_intersects(sched_domain_span(sd), entry->cpu_mask)) {
++asym_cap_count;
} else if (cpumask_intersects(entry->cpu_mask, cpu_map)) {
sd_asym_flags &= ~SD_ASYM_CPUCAPACITY_FULL;
if (asym_cap_count > 1)
break;
}