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 --- arch/powerpc/include/asm/pgalloc.h | 2 +- arch/powerpc/mm/book3s64/pgtable.c | 2 +- arch/powerpc/mm/mmu_context.c | 2 +- arch/powerpc/mm/pgtable.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h index 3a971e2a8c73..88acccc5b06e 100644 --- a/arch/powerpc/include/asm/pgalloc.h +++ b/arch/powerpc/include/asm/pgalloc.h @@ -7,7 +7,7 @@ #ifndef MODULE static inline gfp_t pgtable_gfp_flags(struct mm_struct *mm, gfp_t gfp) { - if (unlikely(mm == &init_mm)) + if (unlikely(mm_is_kernel(mm))) return gfp; return gfp | __GFP_ACCOUNT; } diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 85ab6723c8f2..eb365f7c8907 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c @@ -395,7 +395,7 @@ static pmd_t *__alloc_for_pmdcache(struct mm_struct *mm) struct ptdesc *ptdesc; gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO; - if (mm == &init_mm) + if (mm_is_kernel(mm)) gfp &= ~__GFP_ACCOUNT; ptdesc = pagetable_alloc(gfp, 0); if (!ptdesc) diff --git a/arch/powerpc/mm/mmu_context.c b/arch/powerpc/mm/mmu_context.c index 3e3af29b4523..b51934c511f3 100644 --- a/arch/powerpc/mm/mmu_context.c +++ b/arch/powerpc/mm/mmu_context.c @@ -48,7 +48,7 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, /* Mark this context has been used on the new CPU */ if (!cpumask_test_cpu(cpu, mm_cpumask(next))) { - VM_WARN_ON_ONCE(next == &init_mm); + VM_WARN_ON_ONCE(mm_is_kernel(next)); cpumask_set_cpu(cpu, mm_cpumask(next)); inc_mm_active_cpus(next); diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index a9be337be3e4..d04f4fecfc7c 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -393,7 +393,7 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr) pte_t *pte; spinlock_t *ptl; - if (mm == &init_mm) + if (mm_is_kernel(mm)) return; pgd = mm->pgd + pgd_index(addr); BUG_ON(pgd_none(*pgd)); -- 2.51.2