Re: [PATCH 1/3] sched/fair: Add asymmetric CPU capacity wakeup scan
From: Quentin Perret
Date: Fri Jan 24 2020 - 07:59:14 EST
Hey Valentin,
On Friday 24 Jan 2020 at 12:42:53 (+0000), Valentin Schneider wrote:
> +/*
> + * Scan the asym_capacity domain for idle CPUs; pick the first idle one on which
> + * the task fits.
> + */
> +static int select_idle_capacity(struct task_struct *p, int target)
> +{
> + struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
> + struct sched_domain *sd;
> + int cpu;
> +
> + if (!static_branch_unlikely(&sched_asym_cpucapacity))
> + return -1;
> +
> + sd = rcu_dereference(per_cpu(sd_asym_cpucapacity, target));
> + if (!sd)
> + return -1;
> +
You might want 'sync_entity_load_avg(&p->se)' here no ?
find_idlest_cpu() and wake_cap() need one, but since we're going to use
them, you'll want to sync here too I think.
> + cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
> +
> + for_each_cpu_wrap(cpu, cpus, target) {
> + if (!available_idle_cpu(cpu))
> + continue;
> + if (!task_fits_capacity(p, capacity_of(cpu)))
> + continue;
> +
> + return cpu;
> + }
If we found an idle CPU, but not one big enough, should we still go
ahead and choose it ? Misfit / idle balance will fix that later when a
big CPU does become available.
> +
> + return -1;
> +}
> +
Thanks,
Quentin