Re: [RFC PATCH 07/13] sched: Add core wide task selection and scheduling.

From: Chen Yu
Date: Sun Apr 19 2020 - 11:31:54 EST


On Fri, Apr 17, 2020 at 7:18 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Thu, Apr 16, 2020 at 11:39:05AM +0800, Chen Yu wrote:
>
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 02495d44870f..ef101a3ef583 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -4477,9 +4477,14 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
> > return next;
> > }
> >
> > - prev->sched_class->put_prev_task(rq, prev);
> > - if (!rq->nr_running)
> > - newidle_balance(rq, rf);
> > +
> > +#ifdef CONFIG_SMP
> > + for_class_range(class, prev->sched_class, &idle_sched_class) {
> > + if (class->balance(rq, prev, rf))
> > + break;
> > + }
> > +#endif
> > + put_prev_task(rq, prev);
> >
> > smt_mask = cpu_smt_mask(cpu);
>
> Instead of duplicating that, how about you put the existing copy in a
> function to share? finish_prev_task() perhaps?
>
> Also, can you please make newidle_balance() static again; I forgot doing
> that in 6e2df0581f56, which would've made you notice this sooner I
> suppose.
Okay, I'll do that,

Thanks,
Chenyu