Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8307695rwd; Tue, 20 Jun 2023 13:14:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pw/jkwZ5WpGOB3Zp+jts2Ihyfh8vd+ER9EPsGrl2tU3yAPTlaVnXdeTcwnUDiIIcBKYJb X-Received: by 2002:a05:6a00:2382:b0:668:8703:a5d4 with SMTP id f2-20020a056a00238200b006688703a5d4mr4844441pfc.31.1687292056413; Tue, 20 Jun 2023 13:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687292056; cv=none; d=google.com; s=arc-20160816; b=oIPaSPPplv7/MPNWUvoFuiA9KAv7ZTVOPqBQXHocxDWI34g0TNmDL+NVOUfsw5b9PW zIFUjeNY2Dp7mdNo6T3BkaPSP7M04QtayRavxET49wwYGQnfg4Nf25zPggzYVsTck2sD RB4bErq5e8LJi5Y2nfA3m5hRKeboV8/5Td2nPCJDPb+a0EhK7qJLaa8zyiUvECy/3dl5 jJPbgaH94cpzvAxbP2AiHN7Jl8URe3N9wiF8WjcWU420xbWXFUH7u8wowZn97ZdsImje hRjZqOTuuicM/Ynf+Gkfsu4RZBJDa0lqoeP8Dh9cjUCjpjhuT2PRmjyz3ISmmKLkhAHG Xy0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=IiBraH1gFEtLq0Kn5mTuDR7eletLpb8dAh5y2pzul9A=; b=Umsshiigpc4c8NwYQhVfrJnXPepU6AV9IqELuPNJ7VPBt4z47P8S5YJ9HuFzZcO3RX jWzcgj2lkCGgZkC1ZlmNuFwmEkNTS9Bx9FLV1IP3+Jkpjj5aOdvHtctF2UIo4UWfaZEB 63Y3/pjW4OM0QLkW5Hspxw7ENNM9O/9SNqF3e5uS4VU8X2dbHxENOQ4HT7RLeF/gWEQm Ql39lmiSTLrqtqGmK3ewYIXw0Xq+roDJulHqj5DsfzD/ogwlAWOuRieo4RWESSvplj/w YqFuxAiCSXmM59EMBeHopNms64Po5hj5cUE8oDprtsqWgtv26Lv6jHwBfy30kpbW5u+y SMhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=GnK6zVkt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020aa78ece000000b006434a04f2fcsi2304699pfr.297.2023.06.20.13.13.28; Tue, 20 Jun 2023 13:14:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=GnK6zVkt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbjFTTy5 (ORCPT + 99 others); Tue, 20 Jun 2023 15:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjFTTyw (ORCPT ); Tue, 20 Jun 2023 15:54:52 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C5E1982 for ; Tue, 20 Jun 2023 12:54:47 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-56fff21c2ebso55292767b3.3 for ; Tue, 20 Jun 2023 12:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687290887; x=1689882887; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=IiBraH1gFEtLq0Kn5mTuDR7eletLpb8dAh5y2pzul9A=; b=GnK6zVktB4fTweKikYzUukoKZGCmVusKP/x6uUrsa1IZh7Lcf11VRj9767YwL28zyx J4JKcGvTfTr/LvFgYj5pm1tfEFEJ8PKkMTUvowkeEnkdtgmC9135h58fxQzErHTduUCX +m+UG/mn18iCUxOKOQQ3TboQqPdTC4trrhg3CdFjun1ZClZ8tNP63vy0pMK4T8o5rwHN Ev/CkGwjSSWdgG/b37eVTxoy7CA9K7VH5ECYT9iqlmvWSv+gngjFQijyE1bOMwoZXb/s MCqGmsFWL/xCVoRj8nY9T1uCu7dqqcS1sL95WKPUvtYF9Sc63RHc6WC/aK2yPQNdgDcy QIWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687290887; x=1689882887; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IiBraH1gFEtLq0Kn5mTuDR7eletLpb8dAh5y2pzul9A=; b=bAQ/VoMtcaAzyVCMijP74XdHRnanDNMZDi4N9PrHZIFD/F8ugP3K0ZGKIuauza3CwC NvhAm22vfAdMUTN2dBiS11KLOrsR4LOWW0DeSJ5fg5DqAPQ5utUk7irwDQVhFKY9dRCk 9ZiVMDaUL1a3vbOMnDSh9WUijjxavEXT98J0QWKT5YjRJ7ZCCm2CJQDg7zrbMXMT7ibh nL4EvqHFj2BPIIKma5gnLkcPzhbdcD/Hr9pZzDgSqiDNpyaQ2CLosI5gL+Cz3nVq7pgL bb612hfx3amddjW2whLYv+51tcZfDHfKAUgeCmMJykW8Iog8ovn+EhzIhyI8WgGyQ7V+ HGBw== X-Gm-Message-State: AC+VfDzWsk7aoXTtnVfOjZRwEmulODBmip21XMmHwgT7kRXILyipUErm AFAKQC5PpB+OwPDAYfqMsVAlXg== X-Received: by 2002:a0d:d106:0:b0:56d:45ec:2e64 with SMTP id t6-20020a0dd106000000b0056d45ec2e64mr14660924ywd.43.1687290886830; Tue, 20 Jun 2023 12:54:46 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id n20-20020a819e54000000b005705cbba0bcsm649525ywj.98.2023.06.20.12.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 12:54:45 -0700 (PDT) Date: Tue, 20 Jun 2023 12:54:25 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Jason Gunthorpe cc: Hugh Dickins , Andrew Morton , Gerald Schaefer , Vasily Gorbik , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David Sc. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Jann Horn , Vishal Moola , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 05/12] powerpc: add pte_free_defer() for pgtables sharing page In-Reply-To: Message-ID: <2ad8b6cf-692a-ff89-ecc-586c20c5e07f@google.com> References: <54cb04f-3762-987f-8294-91dafd8ebfb0@google.com> <5cd9f442-61da-4c3d-eca-b7f44d22aa5f@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Jun 2023, Jason Gunthorpe wrote: > On Tue, Jun 20, 2023 at 12:47:54AM -0700, Hugh Dickins wrote: > > Add powerpc-specific pte_free_defer(), to call pte_free() via call_rcu(). > > pte_free_defer() will be called inside khugepaged's retract_page_tables() > > loop, where allocating extra memory cannot be relied upon. This precedes > > the generic version to avoid build breakage from incompatible pgtable_t. > > > > This is awkward because the struct page contains only one rcu_head, but > > that page may be shared between PTE_FRAG_NR pagetables, each wanting to > > use the rcu_head at the same time: account concurrent deferrals with a > > heightened refcount, only the first making use of the rcu_head, but > > re-deferring if more deferrals arrived during its grace period. > > You didn't answer my question why we can't just move the rcu to the > actual free page? I thought that I had answered it, perhaps not to your satisfaction: https://lore.kernel.org/linux-mm/9130acb-193-6fdd-f8df-75766e663978@google.com/ My conclusion then was: Not very good reasons: good enough, or can you supply a better patch? Hugh > > Since PPC doesn't recycle the frags, we don't need to carefully RCU > free each frag, we just need to RCU free the entire page when it > becomes eventually free? > > Jason