Re: [PATCH v2 8/9] sched/fair: Split select_task_rq_fair want_affine logic

From: Dietmar Eggemann
Date: Thu Mar 19 2020 - 06:30:22 EST


On 11.03.20 19:16, Valentin Schneider wrote:

[...]

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index f98dac0c7f82..a6fca6817e92 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6620,26 +6620,33 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
> }
>
> rcu_read_lock();
> +
> + sd = highest_flag_domain(cpu, sd_flag);
> +
> + /*
> + * If !want_affine, we just look for the highest domain where
> + * sd_flag is set.
> + */
> + if (!want_affine)
> + goto scan;
> +
> + /*
> + * Otherwise we look for the lowest domain with SD_WAKE_AFFINE and that
> + * spans both 'cpu' and 'prev_cpu'.
> + */
> for_each_domain(cpu, tmp) {
> - /*
> - * If both 'cpu' and 'prev_cpu' are part of this domain,
> - * cpu is a valid SD_WAKE_AFFINE target.
> - */
> - if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
> + if ((tmp->flags & SD_WAKE_AFFINE) &&
> cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
> if (cpu != prev_cpu)
> new_cpu = wake_affine(tmp, p, cpu, prev_cpu, sync);
>
> - sd = NULL; /* Prefer wake_affine over balance flags */
> + /* Prefer wake_affine over SD lookup */

I assume that 'balance flags' stands for (wakeup) load balance, i.e.
find_idlest_xxx() path. So why change it?


[...]