Re: [PATCH v2] sched_ext: Introduce LLC awareness to the default idle selection policy

From: Andrea Righi
Date: Tue Oct 22 2024 - 10:56:10 EST


On Tue, Oct 22, 2024 at 12:14:22PM +0200, Andrea Righi wrote:
...
> + /*
> + * Determine the task's LLC domain.
> + */
> + llc_mask = llc_domain(prev_cpu);
> + if (llc_cpus && llc_mask)
> + llc_empty = !cpumask_and(llc_cpus, llc_mask, p->cpus_ptr);
> + else
> + llc_empty = true;

Thinking more about this, we can avoid re-generating the llc_cpus
cpumask when the task can run on all CPUs (likely the majority of the
cases) and it's probably more efficient to check for
cpumask_equal(p->cpus_ptr, cpu_possible_mask) and just use llc_mask in
this case.

We could also optimize tasks that can only run on 1 CPU, but we never
call ops.select_cpu() for them, they're just skipped in
select_task_rq(), so I'm not sure if we should handle this special case
(maybe I can add a comment, to make it more clear).

-Andrea