[PATCH 07/22] parisc: mm: use mm_is_kernel() for kernel mm checks

From: Kevin Brodsky

Date: Tue Jul 14 2026 - 10:07:02 EST


The new MMF_KERNEL flag identifies kernel-owned mm's. Checking the
flag with mm_is_kernel() is preferred over comparing directly
against &init_mm.

No functional change, as only init_mm has MMF_KERNEL set for now.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Kevin Brodsky <kevin.brodsky@xxxxxxx>
---
arch/parisc/include/asm/mmu_context.h | 2 +-
arch/parisc/include/asm/pgalloc.h | 2 +-
arch/parisc/include/asm/tlbflush.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h
index c9187fe836a3..e265da67559e 100644
--- a/arch/parisc/include/asm/mmu_context.h
+++ b/arch/parisc/include/asm/mmu_context.h
@@ -87,7 +87,7 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
* already, so we should be OK.
*/

- BUG_ON(next == &init_mm); /* Should never happen */
+ BUG_ON(mm_is_kernel(next)); /* Should never happen */

if (next->context.space_id == 0)
next->context.space_id = alloc_sid();
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 3b84ee93edaa..9f09cc4fa5dd 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -34,7 +34,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
struct ptdesc *ptdesc;
gfp_t gfp = GFP_PGTABLE_USER;

- if (mm == &init_mm)
+ if (mm_is_kernel(mm))
gfp = GFP_PGTABLE_KERNEL;
ptdesc = pagetable_alloc(gfp, PMD_TABLE_ORDER);
if (!ptdesc)
diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
index 5ffd7c17f593..a5a6cfff295c 100644
--- a/arch/parisc/include/asm/tlbflush.h
+++ b/arch/parisc/include/asm/tlbflush.h
@@ -35,7 +35,7 @@ int __flush_tlb_range(unsigned long sid,

static inline void flush_tlb_mm(struct mm_struct *mm)
{
- BUG_ON(mm == &init_mm); /* Should never happen */
+ BUG_ON(mm_is_kernel(mm)); /* Should never happen */

#if 1 || defined(CONFIG_SMP)
/* Except for very small threads, flushing the whole TLB is

--
2.51.2