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

From: Peter Zijlstra
Date: Tue Sep 27 2022 - 07:29:11 EST


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' ?

> 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?

> +
> + if (busiest_class_delta_score < curr_class_delta_score) {
> + busiest_class_delta_score = curr_class_delta_score;
> + busiest_nr = nr_running;
> + busiest = rq;
> + }
> }
> break;