Re: [PATCH] sched: fair: don't depend on wake_wide if waker and wakee are already in same LLC
From: Peter Zijlstra
Date: Wed May 26 2021 - 08:16:29 EST
$subject is weird; sched/fair: is the right tag, and then start with a
capital letter.
On Wed, May 26, 2021 at 09:10:57PM +1200, Barry Song wrote:
> when waker and wakee are already in the same LLC, it is pointless to worry
> about the competition caused by pulling wakee to waker's LLC domain.
But there's more than LLC.
> Signed-off-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>
> ---
> kernel/sched/fair.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 3248e24a90b0..cfb1bd47acc3 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6795,7 +6795,15 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
> new_cpu = prev_cpu;
> }
>
> - want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr);
> + /*
> + * we use wake_wide to make smarter pull and avoid cruel
> + * competition because of jam-packed tasks in waker's LLC
> + * domain. But if waker and wakee have been already in
> + * same LLC domain, it seems it is pointless to depend
> + * on wake_wide
> + */
> + want_affine = (cpus_share_cache(cpu, prev_cpu) || !wake_wide(p)) &&
> + cpumask_test_cpu(cpu, p->cpus_ptr);
> }
And no supportive numbers...