Re: [PATCH v5 2/2] sched/fair: Check a task has a fitting cpu when updating misfit

From: Qais Yousef
Date: Tue Feb 06 2024 - 10:37:12 EST


On 02/06/24 18:55, Hillf Danton wrote:

> > +/*
> > + * Check the max capacity the task is allowed to run at for misfit detection.
> > + */
> > +static void set_task_max_allowed_capacity(struct task_struct *p)
> > +{
> > + struct asym_cap_data *entry;
> > +
> > + if (!sched_asym_cpucap_active())
> > + return;
> > +
> > + rcu_read_lock();
> > + list_for_each_entry_rcu(entry, &asym_cap_list, link) {
> > + cpumask_t *cpumask;
> > +
> > + cpumask = cpu_capacity_span(entry);
> > + if (!cpumask_intersects(p->cpus_ptr, cpumask))
> > + continue;
> > +
> > + p->max_allowed_capacity = entry->capacity;
> > + break;
>
> Given what max_allowed_capacity could mean, it is needed to find the max
> capacity by iterating the asym_cap_list instead of the first capacity
> determined by the allowed CPU mask.

I don't think we can rely on that as there is no guarantee on the position of
the biggest CPU. We would have to iterate through every CPU in the mask instead
to figure out the one with the largest capacity. And we moved to this as
Vincent wasn't keen on assuming we have few CPUs and potentially not scaling on
systems with large number of CPUs. This list should be faster as the number of
capacity level is much smaller than the number of CPUs.

> > + }
> > + rcu_read_unlock();
> > +}
>
> BTW is it working in case of systems with a super core?
>
> cpu0-3 cpu4-6 cpu7
> little big super
> core core core

It should. Super here should have the capacity of 1024 and everything else
scaled relative to it like any other system with 3 tiers of capacities.