[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200206030900.147032-12-leonardo@linux.ibm.com>
Date: Thu, 6 Feb 2020 00:09:00 -0300
From: Leonardo Bras <leonardo@...ux.ibm.com>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@....fr>,
Steven Price <steven.price@....com>,
Robin Murphy <robin.murphy@....com>,
Leonardo Bras <leonardo@...ux.ibm.com>,
Mahesh Salgaonkar <mahesh@...ux.vnet.ibm.com>,
Balbir Singh <bsingharora@...il.com>,
Reza Arbab <arbab@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Allison Randal <allison@...utok.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mike Rapoport <rppt@...ux.ibm.com>,
Michal Suchanek <msuchanek@...e.de>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
kvm-ppc@...r.kernel.org, linux-arch@...r.kernel.org,
linux-mm@...ck.org
Subject: [PATCH v6 11/11] powerpc/mm/book3s64/pgtable: Uses counting method to skip serializing
For each cpu in cpumask, checks if it's running a lockless pagetable
walk. Then, run serialize_against_pte_lookup() only on these cpus.
serialize_agains_pte_lookup() can take a long while when there are a
lot of cpus in cpumask.
This method is intended to reduce this waiting, while not impacting
too much on the lockless pagetable walk.
Signed-off-by: Leonardo Bras <leonardo@...ux.ibm.com>
---
arch/powerpc/mm/book3s64/pgtable.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c
index bb138b628f86..4822ff1aac4b 100644
--- a/arch/powerpc/mm/book3s64/pgtable.c
+++ b/arch/powerpc/mm/book3s64/pgtable.c
@@ -96,8 +96,22 @@ static DEFINE_PER_CPU(int, lockless_pgtbl_walk_counter);
*/
void serialize_against_pte_lookup(struct mm_struct *mm)
{
+ int cpu;
+ struct cpumask cm;
+
smp_mb();
- smp_call_function_many(mm_cpumask(mm), do_nothing, NULL, 1);
+
+ /*
+ * Fills a new cpumask only with cpus that are currently doing a
+ * lockless pagetable walk. This reduces time spent in this function.
+ */
+ cpumask_clear(&cm);
+ for_each_cpu(cpu, mm_cpumask((mm))) {
+ if (per_cpu(lockless_pgtbl_walk_counter, cpu) > 0)
+ cpumask_set_cpu(cpu, &cm);
+ }
+
+ smp_call_function_many(&cm, do_nothing, NULL, 1);
}
/* begin_lockless_pgtbl_walk: Must be inserted before a function call that does
--
2.24.1
Powered by blists - more mailing lists