From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B12A548B396; Tue, 14 Jul 2026 15:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041515; cv=none; b=pXzzau+MLf/NOykCbyQr/K4p+dPmSRA11zUqqfO/8iNc9pGfmHuyh7heKdVDeOIARNN1fsJ8vc46xxfZe8yQk6SALK+NfjXegqP+/6Qt+bydyJWtp0ltCGgsKCXch4111m4A3nSCz7OiYoM7COU/pwdb/l4QvtyehWlCC/gS4kw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041515; c=relaxed/simple; bh=HHJkedvqLGkWxIj2Z1wggFPycBLi0/kdB+Mtl8peKIM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oC99ID8sKe64/ifHZF+r07edSI+ihzpyesiEZNaBMOYHtFSp13yNLODGB6KJUVg/p19OfDrIdCGGttJsfnkPTARVWzlicm3mmURRT8SFO+6XBSMIl7oHOc6lVpCP1QixBCSSKcR08SjL/Kt2szIKrq4wkzrYkJ5nmHLkKncwsQ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=crOD2NmJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="crOD2NmJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24AA51F000E9; Tue, 14 Jul 2026 15:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784041514; bh=AYjyETDBZwm0j/cPjjIgSYujcuHtX92Lh9M1By4BrMc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=crOD2NmJDWob7tNH4b0nB1FiZnokFnKZDkP0Ght7V6I9Wl8zmC+0pmKCW+kuXLlLH OdZHmkh/T/9BB42ZvoZwp60T/mYLQwb+uOSlwDUb+jGK/rXpggWk3voCs1+1oCHlIy LXTlYETzj3M++Bh5NzIk2buDSGg3fmS7KG1J0rfl/O/1fHossnuwmJ7LiswfHs+0P0 ffWQo61tvdjoVoC7hXSzokGWOo+sPo7j+/6Jfs2msT1jdScy1yBzSMh3QvyUVNtNcz 99aBb5YGUL9jfl1vNkXPGp7NC4uErRwi1ismiMLOqmhMcboruizzYkE3vXwJGQsEgm RUE53xPNgB+iQ== Date: Tue, 14 Jul 2026 16:04:52 +0100 From: "Lorenzo Stoakes (ARM)" To: Dave Hansen Cc: Kevin Brodsky , linux-mm@kvack.org, Andrew Morton , David Hildenbrand , "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 Subject: Re: [PATCH 03/22] mm: introduce MMF_KERNEL flag and set it for init_mm Message-ID: References: <20260714-remove_pgtable_cdtor-v1-0-44be8a7685d7@arm.com> <20260714-remove_pgtable_cdtor-v1-3-44be8a7685d7@arm.com> <71045fa8-89fe-4a0b-a05b-67e19ce89834@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71045fa8-89fe-4a0b-a05b-67e19ce89834@intel.com> On Tue, Jul 14, 2026 at 07:47:43AM -0700, Dave Hansen wrote: > On 7/14/26 07:03, Kevin Brodsky wrote: > > +static inline bool mm_is_kernel(const struct mm_struct *mm) > > +{ > > + return mm && mm_flags_test(MMF_KERNEL, mm); > > +} > > Could we give this some nice comments explaining what a kernel mm is, > please? Part of the problem with the init_mm checks is that they're > magic and it's not always clear what's special about init_mm. > > Maybe start with this list? > > 1. There's only one of them. > 2. All kernel threads share it. tsk->mm is the same for all kernel > threads. > 3. It holds the reference copy of the kernel page tables > 4. Userspace can't be entered when it is the current mm > 5. It has different TLB flushing rules than userspace mms > > I _think_ those are universal across all architectures. Well point 1 isn't true of efimm or tboot_mm so we possibly need a better name :) "Special" is overloaded too much already. I quite like "eternal" so: static inline bool mm_is_eternal(const struct mm_struct *mm) { return mm && mm_flags_test(MMF_ETERNAL, mm); } :) Cheers, Lorenzo 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 401ECC44501 for ; Tue, 14 Jul 2026 15:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qABCo73M8pgI/QnY02VUJKd0FgJ2PjoODXTNH5l1zJE=; b=wXadFdYZ8yjjQ6 lnpock+pmtMLrThEmJSG0MLgpoGu4WYuf0pOqicSK+j81v7AyXq3I5JNfR21u7bPphpG2C2aQjUUb dI8MlRU/eajzWaJvudw64em2hbuQEUO9s3IgVUyj5Nv9UXDiQYcnvr284uDnj+W9G0udr/e2FPoYa 4ranrd1zLn+dnLVv506VL1DcmFq2NsAb9ITDY3/w2fvd4jU7sPKLFQDH5S9kZLzCFuezqNBRQ/QmL 518534+GFRhKVHWfN9WmxtDAGJtMWymeILQlZAme7pMTyhC6AjyHM25gSf7kCj/jlGMw3jJ/HHBW5 uF+NZ75BEsxreoAYAA8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjehB-0000000CSpn-1Gq7; Tue, 14 Jul 2026 15:05:17 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjeh9-0000000CSp3-3S5x; Tue, 14 Jul 2026 15:05:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id B803C60103; Tue, 14 Jul 2026 15:05:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24AA51F000E9; Tue, 14 Jul 2026 15:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784041514; bh=AYjyETDBZwm0j/cPjjIgSYujcuHtX92Lh9M1By4BrMc=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=crOD2NmJDWob7tNH4b0nB1FiZnokFnKZDkP0Ght7V6I9Wl8zmC+0pmKCW+kuXLlLH OdZHmkh/T/9BB42ZvoZwp60T/mYLQwb+uOSlwDUb+jGK/rXpggWk3voCs1+1oCHlIy LXTlYETzj3M++Bh5NzIk2buDSGg3fmS7KG1J0rfl/O/1fHossnuwmJ7LiswfHs+0P0 ffWQo61tvdjoVoC7hXSzokGWOo+sPo7j+/6Jfs2msT1jdScy1yBzSMh3QvyUVNtNcz 99aBb5YGUL9jfl1vNkXPGp7NC4uErRwi1ismiMLOqmhMcboruizzYkE3vXwJGQsEgm RUE53xPNgB+iQ== Date: Tue, 14 Jul 2026 16:04:52 +0100 From: "Lorenzo Stoakes (ARM)" To: Dave Hansen Cc: Kevin Brodsky , linux-mm@kvack.org, Andrew Morton , David Hildenbrand , "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 Subject: Re: [PATCH 03/22] mm: introduce MMF_KERNEL flag and set it for init_mm Message-ID: References: <20260714-remove_pgtable_cdtor-v1-0-44be8a7685d7@arm.com> <20260714-remove_pgtable_cdtor-v1-3-44be8a7685d7@arm.com> <71045fa8-89fe-4a0b-a05b-67e19ce89834@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <71045fa8-89fe-4a0b-a05b-67e19ce89834@intel.com> X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, Jul 14, 2026 at 07:47:43AM -0700, Dave Hansen wrote: > On 7/14/26 07:03, Kevin Brodsky wrote: > > +static inline bool mm_is_kernel(const struct mm_struct *mm) > > +{ > > + return mm && mm_flags_test(MMF_KERNEL, mm); > > +} > > Could we give this some nice comments explaining what a kernel mm is, > please? Part of the problem with the init_mm checks is that they're > magic and it's not always clear what's special about init_mm. > > Maybe start with this list? > > 1. There's only one of them. > 2. All kernel threads share it. tsk->mm is the same for all kernel > threads. > 3. It holds the reference copy of the kernel page tables > 4. Userspace can't be entered when it is the current mm > 5. It has different TLB flushing rules than userspace mms > > I _think_ those are universal across all architectures. Well point 1 isn't true of efimm or tboot_mm so we possibly need a better name :) "Special" is overloaded too much already. I quite like "eternal" so: static inline bool mm_is_eternal(const struct mm_struct *mm) { return mm && mm_flags_test(MMF_ETERNAL, mm); } :) Cheers, Lorenzo _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv