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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5791CEB64D7 for ; Tue, 20 Jun 2023 11:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232792AbjFTLqR (ORCPT ); Tue, 20 Jun 2023 07:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232798AbjFTLqF (ORCPT ); Tue, 20 Jun 2023 07:46:05 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 026491BDD for ; Tue, 20 Jun 2023 04:45:50 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-666edfc50deso2251700b3a.0 for ; Tue, 20 Jun 2023 04:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1687261549; x=1689853549; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eWdugmL7jiCCazRwRTiCxhXSGGIdZDMM/iY0UbvTdUM=; b=cnn8IRs9UEV2IyxM2/dyNE8Ybbqmsnj6tLoR8M1bmXQAVunFEwC20TKu6DUOVKG4AB L2Yp6/XPUf6F5Xy+nc7uJZfoC02InmQWSMblYoG/4uAdrA9GIFvL7kwUb/yEeNhYFGr1 bkwG9DCJKJm7UPMDVOHOR7oHEfHhzz1mYZlMGy4Z2i7tBudfceWk0OsWq4cf8C2qfKpV w9kz4Q6fy8cbK1P9tLY7jnan9hyd8ZaBomTDWQJ4IaOPbEXOkOCCXRQOiThAn1UjmjTv PMpNa0lpCABevs0dIyQN5iH+zWSS9D1PjlkqlJwomy4rRdkHiQnPe7pPZunP1WQZBtR3 zPdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687261549; x=1689853549; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eWdugmL7jiCCazRwRTiCxhXSGGIdZDMM/iY0UbvTdUM=; b=ey6XKFq0v4ydWJ4k5OmTwtmVtKupTrl+injkPZBJmlzPvv41aR4AWm5JUf0yXWDxdW xYwkSk1/NsEEOFuCmBkyTBCpOOxWri2Joga/rFxRFHKeE7YUOQuRSi/IoguPu6dja07E sjI/ILyDTECRbDfi+bw3SGqE8HjXLol+AspL55A3IbpjeYrVe2ZlHosT7N502riqlRRe NNycXa4Fplcdd31SaHToekbiJSAY04Tlb6UQkcG1Rc3jlorGykreLA9VGcr96siw11Gz 7AXZY5lGJVXg4o7cxim/ESU7UrFQB5bQtX5yjNi7xjZC/Ap1jo1TjJQH1l8h4ChV/vhX VMXA== X-Gm-Message-State: AC+VfDzKtESQPOpBXJmaGtE9vJgoFbPToi2wiG1Fvy7Nf5syHtZX2cfa DjzETXdxCrRxmCIVneKtG13Yow== X-Google-Smtp-Source: ACHHUZ4X6nDwRKfeDuMyEgMyTrD6VgfsYjM5cSKUHYx3cAu4vDqqHRc1ln2Pqg94YC+C6bvDGfs7/g== X-Received: by 2002:a05:6a00:1820:b0:668:732d:7d9f with SMTP id y32-20020a056a00182000b00668732d7d9fmr10033336pfa.2.1687261549460; Tue, 20 Jun 2023 04:45:49 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id d17-20020aa78e51000000b0062d859a33d1sm1207199pfr.84.2023.06.20.04.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jun 2023 04:45:48 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qBZnv-007KSY-BA; Tue, 20 Jun 2023 08:45:47 -0300 Date: Tue, 20 Jun 2023 08:45:47 -0300 From: Jason Gunthorpe To: Hugh Dickins Cc: 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 Message-ID: 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 Content-Disposition: inline In-Reply-To: <5cd9f442-61da-4c3d-eca-b7f44d22aa5f@google.com> Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org 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? 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