From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB0E9C44508 for ; Tue, 14 Jul 2026 14:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WEPAEMG15c2gH/O6ihAUxmO/06ck6asqsv3XqqkfCYY=; b=SiiYrRQf8fTsGU1h6q1D866SfY X5nmy/i8giE/eL+quMBoF3D6LoOI6YTMc5J+b/6+E/yQiMlc2+G312xVoF1Q0+Hipb1rAUfqFnUlZ XPLWPLA8caHm/jHt/PHA3+o3e6qks+sf8XOP+AeCHNpyPj5wEsotG3lLgPsdQx+JEaMioOYm6eUxZ B1Sq6OnXgLxjTQ/b12l/6rjsQda6usmhVJH8+IJ/fDtQJ/P/yYOZdtFMvLJrzWWLBoqxk5vfAfl6A mFdKkNykIbyyihJv+RERfvrTQUnCYXwwvy4unxp1WF7G73BRCvS9HXr3APXVRodPVvOhE/GM/uTVH F89HXB7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjdmJ-0000000CIeX-2BeG; Tue, 14 Jul 2026 14:06:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjdmC-0000000CIY4-1rav; Tue, 14 Jul 2026 14:06:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=WEPAEMG15c2gH/O6ihAUxmO/06ck6asqsv3XqqkfCYY=; b=hD15cyNr3ed382SCFl5JnN+ANK kvpX38r6dYm/gYI2OdsDAs7Ca1IHvzWCvrrcOxl0A5GLLeka6zqG4pOlkJnYyNspHQFPmljfJOGzI tBpsMkETagUDUeo0+v7fH2C1n1i6BEdjO2WtKdJMCVYYchMU8MlELElZYjv0TEm1D+gsp9AIdbuNz H1e/Ks2AnHhNCx8TeeBdHbRoW1zgKAc0acXJmzWULecWSb9XyJf4JWjJWE0Fl4trH2TiqECDYFTBj xfIH0pqGiEDEjsO35HuMnCx1Ju6CCAenE0WJOcJHDiwGJARmPDZQ19G1cmMJyX1YYyzcZEoYyvFLL 4px+IX+w==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.99.2 #2 (Red Hat Linux)) id 1wjdm9-0000000CZ3J-0HLl; Tue, 14 Jul 2026 14:06:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 79F011BB2; Tue, 14 Jul 2026 07:06:15 -0700 (PDT) Received: from localhost.localdomain (e123572-lin.cambridge.arm.com [10.2.208.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FE263F7B4; Tue, 14 Jul 2026 07:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784037979; bh=NDusZRNCWoEozZsjG5aWosyCUDI8Y1KKdd/tV+nqCY0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g68p8jn2r/BRs15OVDSJM5PC0vX+xZEjL9qs6O4bNrlLAmFr23nxaTMwPJrtgFVSe PO42BSv3F1n/0/KY29fSo68pViH3svUbemsg+2g8ZALHR7Gb34DvnaAe4yB7K0yUyn X1Qg4PRgk23qfvxdXOP4RJxy06FeoAcjmt/U8Rmo= From: Kevin Brodsky Date: Tue, 14 Jul 2026 15:03:58 +0100 Subject: [PATCH 09/22] s390: mm: use mm_is_kernel() for kernel mm checks MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260714-remove_pgtable_cdtor-v1-9-44be8a7685d7@arm.com> References: <20260714-remove_pgtable_cdtor-v1-0-44be8a7685d7@arm.com> In-Reply-To: <20260714-remove_pgtable_cdtor-v1-0-44be8a7685d7@arm.com> To: linux-mm@kvack.org Cc: Kevin Brodsky , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Pasha Tatashin , Russell King , Catalin Marinas , Will Deacon , Ryan Roberts , linux-arm-kernel@lists.infradead.org, Huacai Chen , loongarch@lists.linux.dev, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Gerald Schaefer , linux-s390@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Ning Sun , x86@kernel.org, tboot-devel@lists.sourceforge.net, Ard Biesheuvel , Ilias Apalodimas , linux-efi@vger.kernel.org, Vishal Moola , Alistair Popple , "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784037902; l=2701; i=kevin.brodsky@arm.com; s=20260427; h=from:subject:message-id; bh=NDusZRNCWoEozZsjG5aWosyCUDI8Y1KKdd/tV+nqCY0=; b=EN7VJwlPWQ2mLOV0RQXIAGmFgLbZqozbS12jiAz8t5flCb4LBC8CQLf9qAbAsIdiWxuJ/h34z +bgdLqbZMrPAgQeOceVSuzYyrvq4LTVvYRTcF4wG9fcsRmwk6IO2SXA X-Developer-Key: i=kevin.brodsky@arm.com; a=ed25519; pk=N2QG+eJKrvkNovwhhwJhnJ4+ScVfsGCHldmqLfcMTFs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260714_150621_504679_40C2B0B1 X-CRM114-Status: GOOD ( 13.56 ) X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org 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/s390/include/asm/mmu_context.h | 2 +- arch/s390/include/asm/pgtable.h | 6 +++--- arch/s390/mm/pgalloc.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index bd1ef5e2d2eb..675f270d0b70 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h @@ -69,7 +69,7 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct * { int cpu = smp_processor_id(); - if (next == &init_mm) + if (mm_is_kernel(next)) get_lowcore()->user_asce = s390_invalid_asce; else get_lowcore()->user_asce.val = next->context.asce; diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index e882663a58e7..f7741e6b417e 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h @@ -1836,21 +1836,21 @@ static inline int has_transparent_hugepage(void) #ifdef CONFIG_PAGE_TABLE_CHECK static inline bool pte_user_accessible_page(struct mm_struct *mm, unsigned long addr, pte_t pte) { - VM_BUG_ON(mm == &init_mm); + VM_BUG_ON(mm_is_kernel(mm)); return pte_present(pte); } static inline bool pmd_user_accessible_page(struct mm_struct *mm, unsigned long addr, pmd_t pmd) { - VM_BUG_ON(mm == &init_mm); + VM_BUG_ON(mm_is_kernel(mm)); return pmd_leaf(pmd) && (pmd_val(pmd) & _SEGMENT_ENTRY_READ); } static inline bool pud_user_accessible_page(struct mm_struct *mm, unsigned long addr, pud_t pud) { - VM_BUG_ON(mm == &init_mm); + VM_BUG_ON(mm_is_kernel(mm)); return pud_leaf(pud); } diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c index 7ac44543e051..d0456b7e73d4 100644 --- a/arch/s390/mm/pgalloc.c +++ b/arch/s390/mm/pgalloc.c @@ -20,7 +20,7 @@ unsigned long *crst_table_alloc_noprof(struct mm_struct *mm) struct ptdesc *ptdesc; unsigned long *table; - if (mm == &init_mm) + if (mm_is_kernel(mm)) gfp &= ~__GFP_ACCOUNT; ptdesc = pagetable_alloc_noprof(gfp, CRST_ALLOC_ORDER); if (!ptdesc) @@ -120,7 +120,7 @@ unsigned long *page_table_alloc_noprof(struct mm_struct *mm) struct ptdesc *ptdesc; unsigned long *table; - if (mm == &init_mm) + if (mm_is_kernel(mm)) gfp &= ~__GFP_ACCOUNT; ptdesc = pagetable_alloc_noprof(gfp, 0); if (!ptdesc) -- 2.51.2