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 60952C7EE24 for ; Fri, 2 Jun 2023 06:03:49 +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:MIME-Version:References:Message-ID: In-Reply-To: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=RXljdrx1hEyJnR1J4WYKEtrrdkzsmhPq31o19DRH/NQ=; b=rsqbyYmVRyoRcL Q/++EeGACyLjgl/pvXcH9mGoYK00cEBaPdO6QA87doleX6n1TeyoFD/ryIA7kIhjfAmnYC6Q8iCaj Df4/cGolJduw6gPitLtlBEBsSzO36LmcNoQ+ctI5/sMxd/uLen/AdwLfLmOQFyTrjwn1d1giuEBQF Zqgw1DqPI4imXvOpTE5f9JxvEoWPRGTQF8xu+PeEA+6MUksBHeUqfiwltp+G5tQhsZtf2YqVfyns0 N4z9PhxAL6CK0evvslnkFstIs4ou8bkrw7WQv/va6ENX8afqSlqRXCCWE5queXtRZKaFgeomhasOJ JMr2jubwAPu9UwyQ8u/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4xsg-005qRI-2a; Fri, 02 Jun 2023 06:03:22 +0000 Received: from mail-yb1-xb35.google.com ([2607:f8b0:4864:20::b35]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4xsd-005qP5-0q for linux-arm-kernel@lists.infradead.org; Fri, 02 Jun 2023 06:03:20 +0000 Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-ba829e17aacso1842562276.0 for ; Thu, 01 Jun 2023 23:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685685796; x=1688277796; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=7zsFlKAGcv+fQqN1VVT9TBfhOrr8gOpZnbD5J9Rbft4=; b=Y1BisDvMhSzU6oLolCbfFVEgLMBmkQqmlhDVPpW2AJeK8jBOlWFdFzL1tmuKOpvK63 GHp/SMU2i1PecHncq+b0lH3okXqlru+09I8QXCT9NALz59R7lsKaFrIT52Hiqg0zxTrC jqOVLA4YrHbMJ8glWqmmX18tl8OerbjfR8d4jWr1vj09V6zTyWVo1xxkRbkx8FKG4Z9E o7UIT7SMKh+6qHbb35DHGZE2LGVQgAMuvaanUZKjDX1mZVWuXTA1af7RiiJxIJKDI/Fw yZw6JHtIxsA5qBBvdFUR4HhBdS3PC2/xGlBXKlhRRsZvH9HBG7Q8HWGC15eDYbLtpv+i H45Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685685796; x=1688277796; 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=7zsFlKAGcv+fQqN1VVT9TBfhOrr8gOpZnbD5J9Rbft4=; b=BlkeyBhweVk9tsRZxDKj+K4N025Yvwx7e6I1u+ENDeH8LZ8amWNNnnwu5FzogXmnNR jMQxAmkYIa3oj51agyTUt83pTZM1yVNHP55OQOHXka9j6VpbcyyWpsB0hOmH88M9enOB EZoEbXeUc2htuG9sUu7o9OEimNBptbJ2O7S3mfsRusWlDUFf5I9Z6oMcgKOfge+IR4/o Ci5OmZhl5ET8RozbxBzyR33NCcXfZJEWUi0m6Am83gJonCn7yIx99uprc7l3IZHmVPDQ SdAbD7Qh/Mv4UNss6pfggdBGM2+0wXrDrv6Y9VMBD4LXSeixaUYr+PYspDpU6u1Owds9 eChw== X-Gm-Message-State: AC+VfDymiJwmHTXWfKcthUWjAeCvbHCuP5i2JErxKrsDl/nufU6GYRzq Y62KvpbOMyozsfXNil4rBByNMQ== X-Google-Smtp-Source: ACHHUZ6eYdbQngpbs2i38U7FBW9tfhwKdbT7ZR71DCB3qxUId8cHs0QRFbdpfBZ1Bt76wUVanJBNhQ== X-Received: by 2002:a0d:d447:0:b0:568:bec5:ebaf with SMTP id w68-20020a0dd447000000b00568bec5ebafmr12482758ywd.12.1685685796445; Thu, 01 Jun 2023 23:03:16 -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 u17-20020a818411000000b0055d7fc2b704sm184207ywf.16.2023.06.01.23.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 23:03:15 -0700 (PDT) Date: Thu, 1 Jun 2023 23:03:11 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Jason Gunthorpe cc: Hugh Dickins , Andrew Morton , 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 , 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 S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Jann Horn , 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 08/12] mm/pgtable: add pte_free_defer() for pgtable as page In-Reply-To: Message-ID: References: <35e983f5-7ed3-b310-d949-9ae8b130cdab@google.com> <739964d-c535-4db4-90ec-2166285b4d47@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230601_230319_298591_3E8C5728 X-CRM114-Status: GOOD ( 30.14 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 31 May 2023, Jason Gunthorpe wrote: > On Sun, May 28, 2023 at 11:23:47PM -0700, Hugh Dickins wrote: > > Add the generic 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 version > > suits all those architectures which use an unfragmented page for one page > > table (none of whose pte_free()s use the mm arg which was passed to it). > > > > Signed-off-by: Hugh Dickins > > --- > > + page = pgtable; > > + call_rcu(&page->rcu_head, pte_free_now); > > People have told me that we can't use the rcu_head on the struct page > backing page table blocks. I understood it was because PPC was using > that memory for something else. In the 05/12 thread, Matthew pointed out that powerpc (and a few others) use the one struct page for multiple page tables, and the lack of multiple rcu_heads means I've got that patch and 06/12 sparc and 07/12 s390 embarrassingly wrong (whereas this generic 08/12 is okay). I believe I know the extra grossness needed for powerpc and sparc: I had it already for powerpc, but fooled myself into thinking not yet needed. But (I haven't quite got there yet) it looks like Gerald is pointing out that s390 is using lru which coincides with rcu_head: I already knew s390 the most difficult, but that will be another layer of difficulty. I expect it was s390 which people warned you of. > > I was hoping Mathew's folio conversion would help clarify this.. I doubt that: what we have for use today is pages, however they are dressed up. > > On the flip side, if we are able to use rcu_head here then we should > use it everywhere and also use it mmu_gather.c instead of allocating > memory and having the smp_call_function() fallback. This would fix it > to be actual RCU. > > There have been a few talks that it sure would be nice if the page > tables were always freed via RCU and every arch just turns on > CONFIG_MMU_GATHER_RCU_TABLE_FREE. It seems to me that patch 10 is kind > of half doing that by making this one path always use RCU on all > arches. > > AFAIK the main reason it hasn't been done was the lack of a rcu_head.. I haven't paid attention to that part of the history, and won't be competent to propagate this further, into MMU-Gather-World; but agree that would be a satisfying conclusion. Hugh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel