[v6,11/11] powerpc/mm/book3s64/pgtable: Uses counting method to skip serializing
diff mbox series

Message ID 20200206030900.147032-12-leonardo@linux.ibm.com
State New
Headers show
  • Introduces new functions for tracking lockless pagetable walks
Related show


Context Check Description
snowpatch_ozlabs/needsstable success Patch has no Fixes tags
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
snowpatch_ozlabs/build-pmac32 fail build failed!
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (530a1cfd52af0aba1af4b1c9a7bc66a202a459b1)

Commit Message

Leonardo Bras Feb. 6, 2020, 3:09 a.m. UTC
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@linux.ibm.com>
 arch/powerpc/mm/book3s64/pgtable.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff mbox series

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_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