Re: [PATCH 3/5] sched/fair: Make select_idle_cpu() proportional to cores

From: Mel Gorman
Date: Thu Jan 14 2021 - 04:29:30 EST


On Wed, Jan 13, 2021 at 05:49:58PM +0100, Vincent Guittot wrote:
> > @@ -7444,11 +7444,20 @@ int sched_cpu_activate(unsigned int cpu)
> > balance_push_set(cpu, false);
> >
> > #ifdef CONFIG_SCHED_SMT
> > - /*
> > - * When going up, increment the number of cores with SMT present.
> > - */
> > - if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
> > - static_branch_inc_cpuslocked(&sched_smt_present);
> > + do {
> > + int weight = cpumask_weight(cpu_smt_mask(cpu));
> > + extern int sched_smt_weight;
>
> coding style problem
>

Presumably you are referring to an extern defined in a C file. That can
move to kernel/sched/sched.h in this patch.

> > <SNIP>
> > /*
> > * Scan the LLC domain for idle CPUs; this is dynamically regulated by
> > * comparing the average scan cost (tracked in sd->avg_scan_cost) against the
> > @@ -6166,10 +6172,12 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t
> > avg_cost = this_sd->avg_scan_cost + 1;
> >
> > span_avg = sd->span_weight * avg_idle;
> > - if (span_avg > 4*avg_cost)
> > + if (span_avg > sis_min_cores*avg_cost)
> > nr = div_u64(span_avg, avg_cost);
> > else
> > - nr = 4;
> > + nr = sis_min_cores;
> > +
> > + nr *= sched_smt_weight;
>
> Also, patch 5 will look at all CPUs of a core in select_idle_core so
> nr will decrement by 1 per core so i don't see the need to multiply by
> sched_smt_weight one patch 5 is applied
>

It makes sense in the context of this patch but can be removed again in
the last patch and then I think sched_smt_weight only exists in core.c

--
Mel Gorman
SUSE Labs