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 BC032C4167B for ; Tue, 5 Dec 2023 16:06:28 +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=uybPkHlnBjzvaUWMoemXJmkdfeoyiuE9EhOPqgsLSHE=; b=c5l4orWrQ3JAh/ 4UNrO0KB0/cNGBGqN/zRgesoy61MQG3VUGh9ff3eDa+P3xYlz4JG9Nfib4ndGXE7OmacDtSb6cTTt yqH2DNkA5wODnfkVMbxztvfcpRQbGLMZNqum6aU2Oh7q4OzyLi5XOV1e5yBhbnWpWBtIs+KuriwbD xn3EdUVRTwX+GRcykRORY46rauW6jH1iDDh5YyDXpkrgYgnX4qJwd3kPBLcyN9KoSvKg+AN625bcj zme+H4Uk0th6QRgWJRA1PnLZU6Aa2AytCjX0aMtijz4YxQD4C2vSnB6rTvZ7i3Zu/N4ms4bDEWrZr P5REgixo6PV9yKFtW3cQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAXvo-007q1P-2b; Tue, 05 Dec 2023 16:05:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAXvm-007q1E-2H for linux-arm-kernel@bombadil.infradead.org; Tue, 05 Dec 2023 16:05:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vZ9hGmOAU2FBZdAcWBT4EroA4dZyM8ao7E1RVyy5W1Q=; b=JfAYiPlIjHY6yui/t2m/kE0wwI NQ+2jYzHxNa0mPbd0fmcYgXvhv1NLrJ5ufZAOKI5GeGjrSTknq7p2pKaPTDOxqhZGPcCk0hsGAvwN FQ9iDXDki6wTVSFIHpXWiZoF7qh/DD4rSm9SX9yTLrkn/1CjUcf+W1NHn4VSyiizp7h/kk4ZcImh1 60HHfxOOehBijlCbWAJsEoulSTiEIpMiFMX+0aftLr1+veiUBaBSdh82CB3/txeuAhQsjmreIAHe+ 24RZQgCsAM8qSjBcquM5jzjbUwQ1txDmwnq25RI28EikbuYdQhlRmba18Ls5HIJDDhUvx3N9zFvtl gnYjTGNg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rAXvi-0022Oo-57; Tue, 05 Dec 2023 16:05:50 +0000 Date: Tue, 5 Dec 2023 16:05:50 +0000 From: Matthew Wilcox To: Ryan Roberts Cc: John Hubbard , Andrew Morton , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , David Rientjes , Vlastimil Babka , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 0/9] variable-order, large folios for anonymous memory Message-ID: References: <20230929114421.3761121-1-ryan.roberts@arm.com> <181a25c2-219e-4af9-9f8e-e5f514bbc4b6@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <181a25c2-219e-4af9-9f8e-e5f514bbc4b6@arm.com> 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 Tue, Nov 14, 2023 at 10:57:07AM +0000, Ryan Roberts wrote: > On 13/11/2023 15:04, Matthew Wilcox wrote: > > On Mon, Nov 13, 2023 at 10:19:48AM +0000, Ryan Roberts wrote: > >> On 13/11/2023 05:18, Matthew Wilcox wrote: > >>> My hope is to abolish the 64kB page size configuration. ie instead of > >>> using the mixture of page sizes that you currently are -- 64k and > >>> 1M (right? Order-0, and order-4) > >> > >> Not quite; the contpte-size for a 64K page size is 2M/order-5. (and yes, it is > >> 64K/order-4 for a 4K page size, and 2M/order-7 for a 16K page size. I agree that > >> intuitively you would expect the order to remain constant, but it doesn't). > >> > >> The "recommend" setting above will actually enable order-3 as well even though > >> there is no HW benefit to this. So the full set of available memory sizes here is: > >> > >> 64K/order-0, 512K/order-3, 2M/order-5, 512M/order-13 > >> > >>> , that 4k, 64k and 2MB (order-0, > >>> order-4 and order-9) will provide better performance. > >>> > >>> Have you run any experiements with a 4kB page size? > >> > >> Agree that would be interesting with 64K small-sized THP enabled. And I'd love > >> to get to a world were we universally deal in variable sized chunks of memory, > >> aligned on 4K boundaries. > >> > >> In my experience though, there are still some performance benefits to 64K base > >> page vs 4K+contpte; the page tables are more cache efficient for the former case > >> - 64K of memory is described by 8 bytes in the former vs 8x16=128 bytes in the > >> latter. In practice the HW will still only read 8 bytes in the latter but that's > >> taking up a full cache line vs the former where a single cache line stores 8x > >> 64K entries. > > > > This is going to depend on your workload though -- if you're using more > > 2MB than 64kB, you get to elide a layer of page table with 4k base, > > rather than taking up 4 cache lines with a 64k base. > > True, but again depending on workload/config, you may have few levels of lookup > for the 64K native case in the first place because you consume more VA bits at > each level. Sorry, missed this email ... let's work it through. With 4k, and a 48-bit VA space, we get 12 bits at the lowest level, then 9 bits each layer, so 4 * 9 + 12 = 48. With a 2MB allocation, we eliminate the bottom layer and examine three cachelines to find it (PGD entry, PUD entry, PMD entry) With 64k, we get 16 bits at the lowest level, then 13 bits each layer, so 3 * 13 + 16 = 55. With a 2MB allocation, we can't eliminate the bottom layer, so we still have to examine three cachelines to find it (PGD, PMD, PTE). If you can fit into a 42-bit address space, you can reduce it by one cache miss, but my impression is that applications which use 21 bits of address space for a single allocation want more address space than your average application. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel