Re: [RFC PATCH 10/23] sched/fair: Use classes of tasks when selecting a busiest runqueue

From: Ricardo Neri
Date: Fri Oct 07 2022 - 19:30:43 EST


On Tue, Sep 27, 2022 at 01:25:57PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 09, 2022 at 04:11:52PM -0700, Ricardo Neri wrote:
>
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 7368a0b453ee..085b1f75d90b 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -10009,6 +10009,7 @@ static struct rq *find_busiest_queue(struct lb_env *env,
> > int i;
> >
> > for_each_cpu_and(i, sched_group_span(group), env->cpus) {
> > + int busiest_class_delta_score = INT_MIN;
>
> You sure you want to break ties toward a negative IPC 'improvement' ?

Yes. We may have a negative IPC class delta if the destination CPU has
lower prioriy than the CPUs in the busiest group. This may occur when
the busiest group is a core with more than one busy SMT sibling.

>
> > unsigned long capacity, load, util;
> > unsigned int nr_running;
> > enum fbq_type rt;
> > @@ -10118,6 +10119,20 @@ static struct rq *find_busiest_queue(struct lb_env *env,
> > if (busiest_nr < nr_running) {
> > busiest_nr = nr_running;
> > busiest = rq;
> > + } else if (sched_task_classes_enabled() &&
> > + busiest_nr == nr_running) {
> > + int curr_class_delta_score;
> > +
> > + curr_class_delta_score = arch_get_task_class_score(rq->curr->class,
> > + env->dst_cpu) -
> > + arch_get_task_class_score(rq->curr->class,
> > + cpu_of(rq));
>
> *sigh*, you really couldn't find a more ugly layout if you tried.
>
> Perhaps use less than novella length identifiers?

Sure, I will revisit the naming of the identifiers.

Thanks and BR,
Ricardo