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 D9F9AC624D4 for ; Tue, 1 Sep 2026 14:24:27 +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=mnbA1v44npj7pLnPIuT8rZyZczrYjefm/wTZFcwG+x0=; b=M/MT9J/jXBuX1c XXEp1ZAX17Pv9vKOYQfsApFfMWZDXhFmm56XBLO3laTsiGiL2OgjxoLc808mpZ7yjP5rS+wxp+VXl xlrQX42TB/A76d71fked4mRSXLi39Iw+dFmeXhCSkTourcIeFgpxHOycchwioRmoLR74qSVLrVufP IaeoEwMKFoLqvIH6Crgw5LobYI/wynrjFzDfo12EdJmPr1iyShO3lB1IrTE+hSXITn/VoJ1e4TNuk g6ewbq9NrlV6GF+RgwghN0u4XJOHZ9lPmr/Lzb55Ybz6OFqn/1a0UDqm9/cBaqKZ2LCbJ4cTq0qcr vOnwIq6cZwzLTa1gfUmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1PPM-0000000CKPG-2t2I; Tue, 01 Sep 2026 14:24:16 +0000 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1PPJ-0000000CKNW-1fVI for linux-riscv@lists.infradead.org; Tue, 01 Sep 2026 14:24:15 +0000 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-9391e3b21fbso295150285a.2 for ; Tue, 01 Sep 2026 07:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1788272651; x=1788877451; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=AMNw5MzyW2DJkQCetuS4jMUrMgDtCzVkmjImJH3QcQw=; b=CNBxLYgJP+8fneULJtygmwJKF57RMZRGoX3R9XfgEyJ7f4aHATM7dKrlYnyzrbOw3D hIVbjH43qsTIOR/179LE6drwoYIq/5bYS+InDOfL/5hoP+qNGmJ0kBqUaDVTQle41eou BljZcAZz0xX7S4jD19bjf6+Q6L+1P1PhoYroEei21lZG9JDZeOKDT+TLIyzazyxLaRow YtgwYwb9M8o2CwU4jdZPM+jdAVJpdxq6tmEIe9YDu+qtJGEXQ6lnXYOxALI7vG8ukLpJ goBpxKwXzhBz2Xw00tS2TlttdJkRLbi8yIH46F3Sah2ZGMmajA5e6UAeCZUvyDOIXNfT Jyig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788272651; x=1788877451; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AMNw5MzyW2DJkQCetuS4jMUrMgDtCzVkmjImJH3QcQw=; b=p6TFFeH9v9+b0OzX7epch6+GweB6XA/b6sl1OBZ1JAlDGCrFsbg6+9S+KZz2surofU zBXaUBjr/Udnmssf74qv93iNmjVQjl1LAqjAMZoh5wYFxXKV4dZyZZhmpmbnrS6AdV5F kNtONWr4GgP8QHiHStBDZcRBosxcLe1BoXlB2XMaGP3ZLqKBCKuTGbKM9xg0VGJnjuz+ JaZCjod5Iw8CQUWNaqcoueQ88IVmv4u3TTTI8bt5Ob3CI8mteZiEbl6My7bM3Tx96CqS kbF2rFCAlsrmV387zPYJweZVmzzW7kRal9Wm0BDHZc87dY6eODctKBcdt5QQt53Qq8iX 2e/w== X-Forwarded-Encrypted: i=1; AHgh+RrLNJRD62AvWjlO8eOZZJ/hw809xu27exp3pGcFmixtnKQ68qZhMlQMYj4ZKSsfUCL/vIDsbPC3ksbWHw==@lists.infradead.org X-Gm-Message-State: AFuF++lbY38danvhaxn9cKvIG4ow3s7WmIcYuNozDbYyeib1H1OYUb7q GhcD+drQHs9S1G3VZelSOeZz6Hwc9UWgwnxXtYXJV1CUMdEfoJCS1gXz/dvv+MJLKgc= X-Gm-Gg: AR+sD115p68tywabtqPc+0khbKaD2t6CMKuyP+0CSeuj699oLAZrU2yj7nGEytWg5Gd 8KBoONqbYRRF+AbEmF7EHXpz8Qd82l+rcQVX08D+lxksMQBQAXwHkXz2siFTIoeIbx+mxsrB8Jz 59zZtx+MAaOyVgU1w2cJ124iWA2rePeh36W/4kCWfkSfDtRiRGmmq0zN3lbHbjUyaHZqGSPQkYK gYs1+U5Uc/8xnH34O0NUUAZ31q2nG70oMoyiO4cpKcKn6jwt69+kSNMrnSub/JesOc0dZChLT1X T84xjc8hK28K+6S7BTIAeH45DKWAYteU8YJ0DFOJdLN8qkfb6P7ReSmDD3blTH9MgjMeJsdGNb6 brE7vw/XuS+ib5CrO82flFefJ81nczx1acbUgq6p6LC4Qg3fkyNxBC8Zf/jFS1pwkQAfQUfJhEB aZtNKmTH0fb19DNaauKTUx4i0cBDl9aP+CLUQuD/YTxednusL728ngEJ+5yMVYvupfyw7AuFCCG Ml9/F/OJ3uEzsqnKYJgapdPOf97I9clo4rKJw5XZ8YIpA== X-Received: by 2002:a05:620a:29d4:b0:934:ab73:ac53 with SMTP id af79cd13be357-939134fe550mr3924451085a.0.1788272649971; Tue, 01 Sep 2026 07:24:09 -0700 (PDT) Received: from ziepe.ca (hlfxns010zw-159-2-239-150.pppoe-dynamic.high-speed.ns.bellaliant.net. [159.2.239.150]) by smtp.gmail.com with ESMTPSA id af79cd13be357-93917012b65sm1040535485a.2.2026.09.01.07.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 07:24:09 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1x1PPE-0000000BgeE-10ID; Tue, 01 Sep 2026 11:24:08 -0300 Date: Tue, 1 Sep 2026 11:24:08 -0300 From: Jason Gunthorpe To: "Lorenzo Stoakes (ARM)" Cc: Kiryl Shutsemau , Andrew Morton , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Guo Ren , Brian Cain , Geert Uytterhoeven , Dinh Nguyen , Simon Schuster , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Yoshinori Sato , 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 , John Hubbard , Peter Xu , 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 Subject: Re: [PATCH 01/12] mm/huge_memory: zap deposited page tables after an RCU grace period Message-ID: <20260901142408.GA56830@ziepe.ca> References: <20260901-rcu-pagetable-freeing-v1-0-5456a81c8212@kernel.org> <20260901-rcu-pagetable-freeing-v1-1-5456a81c8212@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260901_072413_552701_DB2303D6 X-CRM114-Status: GOOD ( 17.24 ) 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, Sep 01, 2026 at 03:12:45PM +0100, Lorenzo Stoakes (ARM) wrote: > It won't be costly at the time of the calls obviously as its deferred. Maybe > increase some time spent in softirq but again is 512x that big of a deal? > > I'm not sure how you'd both defer the free and somehow utilise mmu_gather here > either really, certainly not without it becoming extremely messy. The less costly version is to thread the page to be freed onto the mmu_gather through a linked list in the struct page memory. This is super cheap since it is just a singly linked list operation. Then when the mmu_gather is flushed it does a single call_rcu using the rcu head of the struct page of the head of the list. The callback clears the entire linked list of pages. Since you have to tlb flush anyhow, it makes sense to always use the mmu_gather. For example the design I ended up with for iommupt accumulates all the invalidations and all the free-able memory into a gather then invalidates and frees. This allows maximizing the tlbi efficiency too. You can't do call_srcu until you flush the tlb and if you call once per table then you are also tlb flushing once per table too. So if the kernel really does want to clear out 512 leaf tables the optimal implementation is one range tlbi for 512 entries followed by one call_rcu to free the memory. Hence the gather.. Jason _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv