Re: [PATCH v10 09/12] x86/mm: enable broadcast TLB invalidation for multi-threaded processes
From: Nadav Amit
Date: Wed Feb 12 2025 - 07:07:31 EST
It all looks pretty sane to me.
One small note:
> On 11 Feb 2025, at 23:08, Rik van Riel <riel@xxxxxxxxxxx> wrote:
>
> +/*
> + * Check whether a process is currently active on more than "threshold" CPUs.
> + * This is a cheap estimation on whether or not it may make sense to assign
> + * a global ASID to this process, and use broadcast TLB invalidation.
> + */
> +static bool mm_active_cpus_exceeds(struct mm_struct *mm, int threshold)
> +{
> + int count = 0;
> + int cpu;
> +
> + /* This quick check should eliminate most single threaded programs. */
> + if (cpumask_weight(mm_cpumask(mm)) <= threshold)
> + return false;
> +
Does it make sense to first check mm.mm_users against the threshold? It might
be less cache-contended.
Anyhow, for what’s it worth:
Reviewed-by: Nadav Amit <nadav.amit@xxxxxxxxx <mailto:nadav.amit@xxxxxxxxx>>