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

From: Mel Gorman
Date: Mon Jan 18 2021 - 04:47:32 EST


On Mon, Jan 18, 2021 at 04:14:36PM +0800, Li, Aubrey wrote:
> > <SNIP>
> > @@ -6124,6 +6126,8 @@ static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int t
> >
> > #else /* CONFIG_SCHED_SMT */
> >
> > +#define sched_smt_weight 1
> > +
> > static inline int select_idle_core(struct task_struct *p, struct sched_domain *sd, int target)
> > {
> > return -1;
> >
> > <SNIP>
> >
> > @@ -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;
>
> Is it better to put this into an inline wrapper to hide sched_smt_weight if !CONFIG_SCHED_SMT?
>

There already is a #define sched_smt_weight for !CONFIG_SCHED_SMT and I
do not think an inline wrapper would make it more readable or maintainable.

--
Mel Gorman
SUSE Labs