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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 45817C98308 for ; Wed, 23 Sep 2026 09:07:11 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4hqWLj5Zwnz2yqw; Wed, 23 Sep 2026 19:07:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1790154429; cv=none; b=oLMutmXGa4+7NJSAWuP6b7yVPyZwSt91RYOxsf+2Si3tZKlzdPMeYFKuONPhoxV2YGMQUP1TIlLcW9s7E3u/UUCdUrqn0D6+CX3DDT3Y92/J2LCGiAiMXrPlt51q+/gLmc+49BqXttYQMiP2tITvVjTgPmRC53iz/yJA1g7DS6MGrAPpbFx03n2lzWCjjwpp9qc6vDmMeSPRk84Jz58XIgzf/N4JEO2/jpJZp/lkWHZ7tBVBqdiadsMUavYdDDkKvWpviBWyOWBWeq/mXPYDZfsrW335rqB8E1uReQ9l/4QmYPXNE48GqXHe7jCOIbUHJzr47tiTooZyF11adPrtMw== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1790154429; c=relaxed/relaxed; bh=ijxX8jmbmIhLUVAlgpu4wGN9OCs93woylxUncz1YJO8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dUt8r0/T00P7y4GojgZtnHGelsFWsjPjieojmGB158nPoPqwZybkdwb29k09UzZuwbVCtoiHFwiM1fd9tXk2gsR4HWf2JfPSGwSFxhyT7ucYXhaW3lXoX2gwcvPXHZj0t1uUd/9sOBUeILCQd4In3myDB9HODCPoqnqE/Kf9WcMZtBl8r+C6/3cRXIEmjOQrmwEEhpCBeVO/VBOppCru96hxepToTfM1tef5ajcQAaSE31H+TFpb3izV+TN0S1wbCoZvdy19UADdDpwT46mcilhiRgLC4Emj+W+aUM/Ylny6dqOX8Y2z8+nW3Dje7gmL4su9F7qdDNq2zylNJwTwMQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bAwdkSD5; dkim-atps=neutral; spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=ljs@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bAwdkSD5; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=ljs@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4hqWLh6W93z2yqq for ; Wed, 23 Sep 2026 19:07:08 +1000 (AEST) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id C401B600AA; Wed, 23 Sep 2026 09:07:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF911F000FF; Wed, 23 Sep 2026 09:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790154426; bh=ijxX8jmbmIhLUVAlgpu4wGN9OCs93woylxUncz1YJO8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bAwdkSD5tOW3uSVWxMzm2cuxEOctSvm7upiBz52QQgLh1Fp9Rd2BrR27jhHQIGX1D 03FLfGYqnqMpsgrwWg6NuY3wCZsFPfpnaSn7FT0wD73NSlHIvsYvEi/JGXmdHhyYBh Efd2lHjnpvzCYvE6IamlA1AxLWKWSLywhDW2Z+KgjD3ZcL9lyDJcNXeZYMDQpwFfPx WXdI3juP8lJmxxiGyfzOaeA5OwQifsTbNhZfOL7TC941WNds3R6K7uUmYZvvKOCLY9 sirrE3GI0tMMCEVeeeA/BxuD/c1QG59rgcina6NubfQn1BvO6FmOYDPEJFO456rfNZ PVwkGIBGoLtpA== Date: Wed, 23 Sep 2026 10:06:43 +0100 From: "Lorenzo Stoakes (ARM)" To: "David Hildenbrand (Arm)" Cc: Andrew Morton , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kiryl Shutsemau , Guo Ren , Brian Cain , Geert Uytterhoeven , Dinh Nguyen , Simon Schuster , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Rich Felker , John Paul Adrian Glaubitz , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Russell King , Vineet Gupta , Michal Simek , Chris Zankel , Max Filippov , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , "David S. Miller" , Andreas Larsson , Richard Henderson , Matt Turner , Magnus Lindholm , Catalin Marinas , Mark Rutland , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , "Christophe Leroy (CS GROUP)" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jason Gunthorpe , John Hubbard , Peter Xu , Yoshinori Sato , Shakeel Butt , Jonathan Corbet , Randy Dunlap , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-snps-arc@lists.infradead.org, linux-arch@vger.kernel.org, sparclinux@vger.kernel.org, linux-alpha@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, Hugh Dickins , Qi Zheng , linux-doc@vger.kernel.org Subject: Re: [PATCH v4 11/12] mm: make userland page table freeing RCU-safe Message-ID: References: <20260922-rcu-pagetable-freeing-v4-0-fe1ad1f1e303@kernel.org> <20260922-rcu-pagetable-freeing-v4-11-fe1ad1f1e303@kernel.org> <72d1548a-a4ee-4832-b2ab-4bc82f1933f8@kernel.org> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72d1548a-a4ee-4832-b2ab-4bc82f1933f8@kernel.org> On Wed, Sep 23, 2026 at 11:04:17AM +0200, David Hildenbrand (Arm) wrote: > On 9/22/26 17:35, Lorenzo Stoakes (ARM) wrote: > > The patch subject confused me at first: that's not what the patch is doing, no? > Previous patches did that, and now you're just removing the leftovers? > > Maybe I'm missing something that this patch does along the lines of teaching the > code to be RCU-safe. It is the final piece that makes that the case, so I think it's OK to allow oneself a nice subject line? No? :) If people are confused they can read the commit message which goes into some detail. > > > Now every architecture has been converted to support > > CONFIG_MMU_GATHER_RCU_TABLE_FREE, this configuration option no longer makes > > any sense to keep around. > > > > Therefore remove it, and remove all the dead code that existed for > > !CONFIG_MMU_GATHER_RCU_TABLE_FREE architectures previously. > > > > Additionally, CONFIG_MMU_GATHER_TABLE_FREE is no longer necessary, as all > > architectures instead use CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE when a custom > > __tlb_remove_table() is required, so remove this too. > > > > A number of architectures only enabled CONFIG_MMU_GATHER_RCU_TABLE_FREE if > > CONFIG_MMU was set, however the mmu_gather logic only actually does > > something meaningful if CONFIG_MMU is set (mmu_gather.c is only compiled in > > this case, for instance). > > > > As a result, there's no need to gate any of this logic on CONFIG_MMU > > explicitly. > > > > CONFIG_PT_RECLAIM however does have a strict dependency on CONFIG_MMU, so > > make this dependency explicit. > > > > Additionally, correct comments to remove references to non-RCU page table > > gathering and make it clear that this is not 'semi-RCU', nor has it been > > since commit 1fb3d8c20bfa ("mm/mmu_gather: replace IPI with > > synchronize_rcu() when batch allocation fails"). > > > > With this change in place the kernel policy is now that userspace page > > tables are freed after an RCU grace period, and thus it is now safe to > > unconditionally perform page table walks under RCU, safe in the knowledge > > that page tables will not be freed underneath the walker. > > > > This is all that is guaranteed, however, so naturally it is still incumbent > > upon page table walkers to ensure that the page table entries are as > > expected. > > > > Acked-by: Kiryl Shutsemau (Meta) > > Signed-off-by: Lorenzo Stoakes (ARM) > > > [...] > > > --- a/mm/Kconfig > > +++ b/mm/Kconfig > > @@ -1465,7 +1465,7 @@ config HAVE_ARCH_TLB_REMOVE_TABLE > > > > config PT_RECLAIM > > def_bool y > > - depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE > > + depends on MMU && !HAVE_ARCH_TLB_REMOVE_TABLE > > help > > Try to reclaim empty user page table pages in paths other than munmap > > and exit_mmap path. > > $ git grep PT_RECLAIM > mm/Kconfig:config PT_RECLAIM > mm/memory.c: if (!IS_ENABLED(CONFIG_PT_RECLAIM)) > mm/mmu_gather.c:#ifdef CONFIG_PT_RECLAIM > mm/mmu_gather.c:#endif /* CONFIG_PT_RECLAIM */ > > whereby all files are MMU-only. > > Makes sense. > > > Very nice > > Acked-by: David Hildenbrand (Arm) Thanks. > > -- > Cheers, > > David -- Cheers, Lorenzo