[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Jul 2022 00:52:40 +1200
From: Barry Song <21cnbao@...il.com>
To: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org, x86@...nel.org,
catalin.marinas@....com, will@...nel.org, linux-doc@...r.kernel.org
Cc: corbet@....net, arnd@...db.de, linux-kernel@...r.kernel.org,
darren@...amperecomputing.com, yangyicong@...ilicon.com,
huzhanyuan@...o.com, lipeifeng@...o.com, zhangshiming@...o.com,
guojian@...o.com, realmz6@...il.com,
Barry Song <v-songbaohua@...o.com>,
Nadav Amit <namit@...are.com>, Mel Gorman <mgorman@...e.de>
Subject: [PATCH 2/4] mm: rmap: Allow platforms without mm_cpumask to defer TLB flush
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)))
should_defer = true;
put_cpu();
--
2.25.1
Powered by blists - more mailing lists