Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp209256rdh; Thu, 23 Nov 2023 01:30:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEutXgo9GlxSXetMk5S8XcVBD60ky7ZYnUvp0AU8Hj3HRcbgNi6a8cDBMjucD1jElT+euOm X-Received: by 2002:a05:6a20:7d9e:b0:18b:885c:7a35 with SMTP id v30-20020a056a207d9e00b0018b885c7a35mr2182090pzj.50.1700731808951; Thu, 23 Nov 2023 01:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700731808; cv=none; d=google.com; s=arc-20160816; b=z8wrKRl+aUtq3e2uupOurKzE3xWgfv41E0jafMpnQSJ1mGzy20EjpyH3I8Xp+07rR8 +f6GglhG200Lyzc2RwBMiXg3Bh4xepmMoZGtTzGAUy7sRobnd9+qF9sQZoqKnZUej4/y XMzdFeOoWwyyiGT958xUT1qJYvmw/bt3OMNYv6SBslHSf/X54d0q5LT2mi9s10EvDlyh bWuo+ZmgupDRTJn8F6DhfInL4ePCOdjo1WrHIMwjVX6MfGr+ZE+hywjov9Mpptlsj3gA O54jEJJrC877PKkX/vtfSLb6ypmn0EvXOF3yDOl+/oEsyMIwk+i7/+bXUDKLCmIzkcAA lhgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=/6Jewe6s2lAA53NpQQ339J2KIqQZoaHRGTOK/DO562w=; fh=l3v+59YVizhyZnVGnm94u+4Al3QaE6nOTDM/GKvyw+0=; b=rrQp//52JioHS7/Rff7n/RuqWhrb9e6sq6pAYA4gcN/53qMlx9f3lTk09N5jbJGIMa TEmcscWitG/OK8zb5Yf9a/DkKisK75iVAZW+1JK8k/fco7RVfoZ+RVCReJu27HdU+9YG jiQcIyZ8eNxhfxa7/L2ExBRGyUAHtiZJjiXDHWjenfFc+bYGr5Zh64HlFcZ6oiGRuE0U HA7jy5MCnnu9S5yx7PqQR6gdRFFwcKAYxaoadaFSnKw+VFuMbwAIval3DjfOTNy8WP8C 3LSn+Occ0ZZFlWUP6Y5zQaWhRui+VwlDeZcqS22zMc2enwgFpNUhBHFlWfIF3220r5BD yVWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=3BjGUXa7; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=kcmgiuMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id by6-20020a056a02058600b005ab776a4d4csi989689pgb.610.2023.11.23.01.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 01:30:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=3BjGUXa7; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=kcmgiuMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 64BF2807864A; Thu, 23 Nov 2023 01:30:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231793AbjKWJ3p (ORCPT + 99 others); Thu, 23 Nov 2023 04:29:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbjKWJ3n (ORCPT ); Thu, 23 Nov 2023 04:29:43 -0500 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA5AD4F for ; Thu, 23 Nov 2023 01:29:49 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 207155C019E; Thu, 23 Nov 2023 04:29:46 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 23 Nov 2023 04:29:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1700731786; x=1700818186; bh=/6 Jewe6s2lAA53NpQQ339J2KIqQZoaHRGTOK/DO562w=; b=3BjGUXa7ROSW9+KBsE ZZDOV4JJt2L9vwcvIIRKpNKreGCXVGdmwdV1Rs/fhD15Y1mbHF5HWRVZ2QBKLnVW yxChHrPogs9t3GaU1pYmIVHH9fvHpinULn2rlx3tY5U28HQv9LxihlKfysK3Ujxj kH02DXm65Biede94fZu4User/nUeC17TLw0f5c5cDx5GkkXZk+0fb+mi6ECbP5NT eA4sufiZOa7LGoDymo2lw44xXaJCqxY1uvNb1ODOyEsddsW4QTRCXK5bgMjZU5IX DaoK5WWpDp42FG0qVTshqj7NzMimScDVkDVx1mQQdiG2ZAjFRq7R10l3ybnsTaqh DvFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1700731786; x=1700818186; bh=/6Jewe6s2lAA5 3NpQQ339J2KIqQZoaHRGTOK/DO562w=; b=kcmgiuMjPl/BWEwHRyPDYEXyzCYRt nV3+mrn3JcvHMyhpk/JCuUPKmDMfj4MsDjJehrnPAOjENPji1JzlkmWTXr/A0BgY aeSCtZERd/1ogaqNAFQe8Wh0BFQldTDPnps9/6mTogVcYjpKBcRnM+FfvRLm0Dps esEsvQO2J8wyUVrHW7p76QEoo4EtSD8PN8U0gpE36NNjybyfYJehoiPhx7m1Fwk4 xP0P/JIG7bfjskm3o8tbqVFSMx3ADENQliRTuPGJgiYbcsUcPY2mOWnac6qoAQNE CBn1qgNFwnty0UhZmyNwDFD7TdvfVss0Z22Ep0FNEYbVl2kJgKXaF4nTQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehfedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvdefjeevfefhvdevjeeuheefieetvdduheeludevtdefhfekleduhfdvjedt ieeinecuffhomhgrihhnpehlfihnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id CF1F9B60089; Thu, 23 Nov 2023 04:29:44 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1234-gac66594aae-fm-20231122.001-gac66594a MIME-Version: 1.0 Message-Id: <94c2e04c-4c62-4ee1-8ae7-cbd675c5064e@app.fastmail.com> In-Reply-To: <20231123065708.91345-1-luxu.kernel@bytedance.com> References: <20231123065708.91345-1-luxu.kernel@bytedance.com> Date: Thu, 23 Nov 2023 10:29:22 +0100 From: "Arnd Bergmann" To: "Xu Lu" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Ard Biesheuvel" , "Anup Patel" , "Atish Patra" Cc: dengliang.1214@bytedance.com, "Xie Yongji" , lihangjing@bytedance.com, "Muchun Song" , punit.agrawal@bytedance.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [RFC PATCH V1 00/11] riscv: Introduce 64K base page Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 23 Nov 2023 01:30:00 -0800 (PST) On Thu, Nov 23, 2023, at 07:56, Xu Lu wrote: > Some existing architectures like ARM supports base page larger than 4K > as their MMU supports more page sizes. Thus, besides hugetlb page and > transparent huge page, there is another way for these architectures to > enjoy the benefits of fewer TLB misses without worrying about cost of > splitting and merging huge pages. However, on architectures with only > 4K MMU, larger base page is unavailable now. > > This patch series attempts to break through the limitation of MMU and > supports larger base page on RISC-V, which only supports 4K page size > now. > > The key idea to implement larger base page based on 4K MMU is to > decouple the MMU page from the base page in view of kernel mm, which we > denote as software page. In contrary to software page, we denote the MMU > page as hardware page. Below is the difference between these two kinds > of pages. We have played with this on arm32, but the conclusion is that it's almost never worth the memory overhead, as most workloads end up using several times the amount of physical RAM after each small file in the page cache and any sparse populated anonymous memory area explodes to up to 16 times the size. On ppc64, using 64KB pages was way to get around limitations in their hashed MMU design, which had a much bigger performance impact because any page table access ends up being a cache miss. On arm64, there are some CPUs like the Fujitsu A64FX that are really bad at 4KB pages and don't support 16KB pages, so this is the only real option. You will see a notable performance benefit in synthetic benchmarks like speccpu with 64KB pages, or on specific computational workloads that have large densely packed memory chunks, but for real workloads, the usual answer is to just use transparent hugepages for larger mappings and a page size of no more than 16KB for the page cache. With the work going into using folios in the kernel (see e.g. https://lwn.net/Articles/932386/), even the workloads that benefit from 64KB base pages should be better off with 4KB pages and just using the TLB hints for large folios. Arnd