[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230312132524.c37abfffe2c70eeda20f3217@linux-foundation.org>
Date: Sun, 12 Mar 2023 13:25:24 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yair Podemsky <ypodemsk@...hat.com>
Cc: will@...nel.org, aneesh.kumar@...ux.ibm.com, npiggin@...il.com,
peterz@...radead.org, arnd@...db.de, linux-arch@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
mtosatti@...hat.com, ppandit@...hat.com, alougovs@...hat.com,
David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only
to MM CPUs
On Sun, 12 Mar 2023 10:09:45 +0200 Yair Podemsky <ypodemsk@...hat.com> wrote:
> Currently the tlb_remove_table_smp_sync IPI is sent to all CPUs
> indiscriminately, this causes unnecessary work and delays notable in
> real-time use-cases and isolated cpus, this patch will limit this IPI to
> only be sent to cpus referencing the effected mm and are currently in
> kernel space.
>
> ...
>
> --- a/mm/mmu_gather.c
> +++ b/mm/mmu_gather.c
> @@ -191,7 +192,15 @@ static void tlb_remove_table_smp_sync(void *arg)
> /* Simply deliver the interrupt */
> }
>
> -void tlb_remove_table_sync_one(void)
> +static bool cpu_in_kernel(int cpu, void *info)
> +{
> + struct context_tracking *ct = per_cpu_ptr(&context_tracking, cpu);
> + int statue = atomic_read(&ct->state);
Strange identifier. Should be "state"?
> + //will return true only for cpu's in kernel space
Please use /* */ style comments
And use "cpus" rather than "cpu's" - plural, not possessive.
> + return !(statue & CT_STATE_MASK);
Using
return state & CT_STATE_MASK == CONTEXT_KERNEL;
would more clearly express the intent.
> +}
And... surely this function is racy. ct->state can change value one
nanosecond after cpu_in_kernel() reads it, so cpu_in_kernel()'s return
value is now wrong?
Powered by blists - more mailing lists