summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/mmu_context.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-07-24 14:28:02 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-08-23 22:28:38 +1000
commita619e59c075c66e530a88e57b45bb0417e2f4fff (patch)
tree5f725ed75bdccc3bbd715ae8fb400ae0e55062b2 /arch/powerpc/include/asm/mmu_context.h
parentb426e4bd77fa2f03723cc0bada80b00c664f67da (diff)
downloadblackbird-op-linux-a619e59c075c66e530a88e57b45bb0417e2f4fff.tar.gz
blackbird-op-linux-a619e59c075c66e530a88e57b45bb0417e2f4fff.zip
powerpc/mm: Optimize detection of thread local mm's
Instead of comparing the whole CPU mask every time, let's keep a counter of how many bits are set in the mask. Thus testing for a local mm only requires testing if that counter is 1 and the current CPU bit is set in the mask. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/mmu_context.h')
-rw-r--r--arch/powerpc/include/asm/mmu_context.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index fb99c27bbf5e..2338abf6101a 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -96,6 +96,14 @@ static inline void switch_mm_pgdir(struct task_struct *tsk,
struct mm_struct *mm) { }
#endif
+#ifdef CONFIG_PPC_BOOK3S_64
+static inline void inc_mm_active_cpus(struct mm_struct *mm)
+{
+ atomic_inc(&mm->context.active_cpus);
+}
+#else
+static inline void inc_mm_active_cpus(struct mm_struct *mm) { }
+#endif
/*
* switch_mm is the entry point called from the architecture independent
@@ -110,6 +118,7 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
/* Mark this context has been used on the new CPU */
if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) {
cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
+ inc_mm_active_cpus(next);
/*
* This full barrier orders the store to the cpumask above vs
OpenPOWER on IntegriCloud