[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67943544-6DAA-4C8A-A04D-029D2D36C318@vmware.com>
Date: Fri, 8 Jul 2022 06:36:47 +0000
From: Nadav Amit <namit@...are.com>
To: Barry Song <21cnbao@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Linux MM <linux-mm@...ck.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, X86 ML <x86@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
Jonathan Corbet <corbet@....net>,
Arnd Bergmann <arnd@...db.de>,
LKML <linux-kernel@...r.kernel.org>,
"darren@...amperecomputing.com" <darren@...amperecomputing.com>,
"yangyicong@...ilicon.com" <yangyicong@...ilicon.com>,
"huzhanyuan@...o.com" <huzhanyuan@...o.com>,
"lipeifeng@...o.com" <lipeifeng@...o.com>,
"zhangshiming@...o.com" <zhangshiming@...o.com>,
"guojian@...o.com" <guojian@...o.com>,
"realmz6@...il.com" <realmz6@...il.com>,
Barry Song <v-songbaohua@...o.com>,
Mel Gorman <mgorman@...e.de>
Subject: Re: [PATCH 2/4] mm: rmap: Allow platforms without mm_cpumask to defer
TLB flush
On Jul 7, 2022, at 5:52 AM, Barry Song <21cnbao@...il.com> wrote:
> From: Barry Song <v-songbaohua@...o.com>
>
> Platforms like ARM64 have hareware TLB shootdown broadcast. They
> don't maintain mm_cpumask and they just send tlbi and related
> sync instructions for TLB flush.
> So if mm_cpumask is empty, we also allow deferred TLB flush
>
> Cc: Nadav Amit <namit@...are.com>
> Cc: Mel Gorman <mgorman@...e.de>
> Signed-off-by: Barry Song <v-songbaohua@...o.com>>
> ---
> mm/rmap.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 5bcb334cd6f2..d320c29a4ad8 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -692,8 +692,13 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags)
> if (!(flags & TTU_BATCH_FLUSH))
> return false;
>
> - /* If remote CPUs need to be flushed then defer batch the flush */
> - if (cpumask_any_but(mm_cpumask(mm), get_cpu()) < nr_cpu_ids)
> + /*
> + * If remote CPUs need to be flushed then defer batch the flush;
> + * If ARCHs like ARM64 have hardware TLB flush broadcast, thus
> + * they don't maintain mm_cpumask() at all, defer batch as well.
> + */
> + if (cpumask_any_but(mm_cpumask(mm), get_cpu()) < nr_cpu_ids ||
> + cpumask_empty(mm_cpumask(mm)))
The cpumask_empty() is indeed just another memory access, which is most
likely ok. But wouldn’t adding something like CONFIG_ARCH_HAS_MM_CPUMASK
make the code simpler and (slightly, certainly slightly) more performant?
Powered by blists - more mailing lists