All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] powerpc/mm: Move pgdir setting into a helper
@ 2017-07-24  4:27 Benjamin Herrenschmidt
  2017-07-24  4:27 ` [PATCH 2/6] powerpc/mm: Avoid double irq save/restore in activate_mm Benjamin Herrenschmidt
                   ` (5 more replies)
  0 siblings, 6 replies; 33+ messages in thread
From: Benjamin Herrenschmidt @ 2017-07-24  4:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: aneesh.kumar, npiggin, Benjamin Herrenschmidt

Makes switch_mm_irqs_off() a bit more readable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/mmu_context.h | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index 94d93f256b94..603b0e5cdec0 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -77,6 +77,26 @@ extern void switch_cop(struct mm_struct *next);
 extern int use_cop(unsigned long acop, struct mm_struct *mm);
 extern void drop_cop(unsigned long acop, struct mm_struct *mm);
 
+#if defined(CONFIG_PPC32)
+static inline void switch_mm_pgdir(struct task_struct *tsk,
+				   struct mm_struct *mm)
+{
+	/* 32-bit keeps track of the current PGDIR in the thread struct */
+	tsk->thread.pgdir = mm->pgd;
+}
+#elif defined(CONFIG_PPC_BOOK3E_64)
+static inline void switch_mm_pgdir(struct task_struct *tsk,
+				   struct mm_struct *mm)
+{
+	/* 64-bit Book3E keeps track of current PGD in the PACA */
+	get_paca()->pgd = mm->pgd;
+}
+#else
+static inline void switch_mm_pgdir(struct task_struct *tsk,
+				   struct mm_struct *mm) { }
+#endif
+
+
 /*
  * switch_mm is the entry point called from the architecture independent
  * code in kernel/sched/core.c
@@ -93,15 +113,9 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
 		new_on_cpu = true;
 	}
 
-	/* 32-bit keeps track of the current PGDIR in the thread struct */
-#ifdef CONFIG_PPC32
-	tsk->thread.pgdir = next->pgd;
-#endif /* CONFIG_PPC32 */
+	/* Some subarchs need to track the PGD elsewhere */
+	switch_mm_pgdir(tsk, next);
 
-	/* 64-bit Book3E keeps track of current PGD in the PACA */
-#ifdef CONFIG_PPC_BOOK3E_64
-	get_paca()->pgd = next->pgd;
-#endif
 	/* Nothing else to do if we aren't actually switching */
 	if (prev == next)
 		return;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2017-08-25  8:04 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-24  4:27 [PATCH 1/6] powerpc/mm: Move pgdir setting into a helper Benjamin Herrenschmidt
2017-07-24  4:27 ` [PATCH 2/6] powerpc/mm: Avoid double irq save/restore in activate_mm Benjamin Herrenschmidt
2017-07-24  4:28 ` [PATCH 3/6] powerpc/mm: Ensure cpumask update is ordered Benjamin Herrenschmidt
2017-07-24 11:20   ` Nicholas Piggin
2017-07-24 20:54     ` Benjamin Herrenschmidt
2017-08-11 11:06     ` Nicholas Piggin
2017-08-11 22:40       ` Benjamin Herrenschmidt
2017-08-17 12:58       ` Michael Ellerman
2017-08-23 12:01   ` [3/6] " Michael Ellerman
2017-07-24  4:28 ` [PATCH 4/6] powerpc/mm: Use mm_is_thread_local() instread of open-coding Benjamin Herrenschmidt
2017-07-24  4:28 ` [PATCH 5/6] powerpc/mm: Optimize detection of thread local mm's Benjamin Herrenschmidt
2017-07-24 11:25   ` Nicholas Piggin
2017-07-24 13:46     ` Michael Ellerman
2017-07-25  0:34       ` Nicholas Piggin
2017-07-25 12:00         ` Michael Ellerman
2017-07-24 20:58     ` Benjamin Herrenschmidt
2017-07-25  0:44       ` Nicholas Piggin
2017-07-25  1:03         ` Benjamin Herrenschmidt
2017-07-25 10:55           ` Nicholas Piggin
2017-08-04 12:06   ` Frederic Barrat
2017-08-04 12:58     ` Benjamin Herrenschmidt
2017-08-21 17:27   ` Frederic Barrat
2017-08-21 17:35     ` Benjamin Herrenschmidt
2017-08-22 13:18       ` Frederic Barrat
2017-08-22 16:55         ` Benjamin Herrenschmidt
2017-08-24 16:40       ` Frederic Barrat
2017-08-24 18:47         ` Benjamin Herrenschmidt
2017-08-25  4:53           ` Frederic Barrat
2017-08-25  7:44             ` Benjamin Herrenschmidt
2017-08-25  8:03               ` Frederic Barrat
2017-08-22  4:28     ` Michael Ellerman
2017-07-24  4:28 ` [PATCH 6/6] powerpc/mm: Make switch_mm_irqs_off() out of line Benjamin Herrenschmidt
2017-08-24 12:37 ` [1/6] powerpc/mm: Move pgdir setting into a helper Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.