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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E43C3DA4B for ; Wed, 17 Jul 2024 10:48:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67AD06B009C; Wed, 17 Jul 2024 06:48:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62B2F6B009E; Wed, 17 Jul 2024 06:48:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F3976B009F; Wed, 17 Jul 2024 06:48:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2FD626B009C for ; Wed, 17 Jul 2024 06:48:50 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CF78DA0A15 for ; Wed, 17 Jul 2024 10:48:49 +0000 (UTC) X-FDA: 82348921578.24.8982DC4 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf25.hostedemail.com (Postfix) with ESMTP id 0A259A0004 for ; Wed, 17 Jul 2024 10:48:47 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721213308; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o2UGm6OkqMkz+HSEYy20m1VPkHDDRp+q8RrQzGWwsFU=; b=bLS9kIhAZLlJZ9KkoaHh3qa7DEF2K25N3JYtAYRen8BEx8LLyYsmriETFXEQiXk1Z+9RJs SWeczpBaq6ZatJF4tt0zxEQer5olnoozcEe3TG+SDP0/rWrxlXJ5weYKvNdwZxVieWlftq skFn5fbIS9lLDijmk5Sg/0EOb2HkOtc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721213308; a=rsa-sha256; cv=none; b=4cEpDYXv82se4e7ShuNiQJ4q0Pi1/rBidySo0jgzenKpfCfG0904QXXxdjWvXBk37Lg3C2 lgEsQxJrcMXcBDgK/5DDHOGAQhnRvyIF+4K1WM3QyrjUj8Nx0fvdFOB+18o7WoHosIQAWE MI5R5O59Ph/QoS/zLw8Y0wz4DZbAdV4= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81BB41063; Wed, 17 Jul 2024 03:49:12 -0700 (PDT) Received: from [10.57.77.222] (unknown [10.57.77.222]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DC253F73F; Wed, 17 Jul 2024 03:48:45 -0700 (PDT) Message-ID: Date: Wed, 17 Jul 2024 11:48:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/2] mm: mTHP stats for pagecache folio allocations Content-Language: en-GB To: David Hildenbrand , Lance Yang , Baolin Wang Cc: Andrew Morton , Hugh Dickins , Jonathan Corbet , "Matthew Wilcox (Oracle)" , Barry Song , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240711072929.3590000-1-ryan.roberts@arm.com> <20240711072929.3590000-3-ryan.roberts@arm.com> <9e0d84e5-2319-4425-9760-2c6bb23fc390@linux.alibaba.com> <756c359e-bb8f-481e-a33f-163c729afa31@redhat.com> <8c32a2fc-252d-406b-9fec-ce5bab0829df@arm.com> <5c58d9ea-8490-4ae6-b7bf-be816dab3356@redhat.com> <9052f430-2c5a-4d9d-b54c-bd093b797702@redhat.com> <5472faf5-1fbe-4a89-a17e-83716fc00b5a@redhat.com> <41831175-6ea4-4e0b-8588-e51e5ee87f19@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 0A259A0004 X-Stat-Signature: jg4wnq46ztd5gyizjr6jc6sngj7dx6qa X-Rspam-User: X-HE-Tag: 1721213327-896385 X-HE-Meta: U2FsdGVkX19sR2Cvy6FoAAo5FP7/n3JSO/YYHRF1cqmaL8jcBQ1P3/KDRM6UGTlxcchnLDbkmmYEqXCF86uDJ6odhKNtkky6vmSf7vg8CKahrgZ3ZY8rrtXEm3osjvKECD/OPN15d/YXEfURyW2nSY6vzcYG9QIugIb1qmyfiH0kEHwyB5G/jst66QHnoYTMZvK6GlQTgZDr2aLCtu4nvuYfVusD5ttuk6QaE1qXevFwQbUV2urTU16VvlHaEEO/7xjWTjFILIkVR/GokUiy3/4x8W+2Fsw0X99fLy4t6C0463pyGWP98SfoKAv99y+d0eL4im5u7CXv656gWe0x/grqcxlXZHY6GH44w3tW3v10/fArW1iIY+7OQtylH+juqhNTVVn0fyPr91NWmaukwYqgRFojUGPh9v6sjvL5ysLk1xIqxFb+CYzFTN7f4IY95a4u5dWxeiehyc5o2vKga2DzIALyB1WPTHUXneT1x8BuhSpBo+Fq33DqTS9l0jcxFIHQjn+C/R23CrYrWRuWc+OOmfWgxTC15EVVMPGFrrsISZDjYBNrhAMCqqgHk/A3D8eyzy/tgtBD41mRLbDQY1Jzz2BsbZO6cGmouEKW0dUL39S5r0A6cWaz1R2rA666YdxyF49EzuRYCgF74D08EN9hlkPntvzvScZaExBUvPyNlb8YXC8RhLmVo4+9cKEJGAT4udsv6XO03wDd0vrY2Kbuo4T5ZfT3kg18yXjkS360qVTBLVoMijpz7jCX79DfzjCmGrYcox5IJZ8nLLPS1MvUMribxTshuydEDuFeNhCrgXFZP2sYm1tgmGJh5bUI776tWmGaaMrHa8qH+Hn7omHlO8xNUa3T8EIpQiz7L7T5gbDENhdwY5qUouLCI0mfX94//OoR0cJx2rF6DxECAbcqjjNY1LRjTnaXIkBfkKhDCKSlfRBj/695o5DWHMOS8/3Anmduv6AEP4N27XB 71HPinX8 mc/sFGxE8UfUky6kJBIda7W/aQGHfBCbxxQJqPMBmgxPwPChCSIkTGmm+XAQkL4Fl2j6wkxjl8LQeqG1UDdcAeS98T50d8vbAvXxT6fXhnQaq7LDxfIL3+c7WlrTNw4OSInOKnBTXoRyW1v1dP1kD0m5AMHnoEARmSvuuvrCimnlYTDk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 17/07/2024 11:25, David Hildenbrand wrote: > On 17.07.24 12:18, Ryan Roberts wrote: >> On 17/07/2024 11:03, David Hildenbrand wrote: >>>>>>>> >>>>>>>> But today, controls and stats are exposed for: >>>>>>>> >>>>>>>>       anon: >>>>>>>>         min order: 2 >>>>>>>>         max order: PMD_ORDER >>>>>>>>       anon-shmem: >>>>>>>>         min order: 2 >>>>>>>>         max order: PMD_ORDER >>>>>>>>       tmpfs-shmem: >>>>>>>>         min order: PMD_ORDER >>>>>>>>         max order: PMD_ORDER >>>>>>>>       file: >>>>>>>>         min order: Nothing yet (this patch proposes 1) >>>>>>>>         max order: Nothing yet (this patch proposes MAX_PAGECACHE_ORDER) >>>>>>>> >>>>>>>> So I think there is definitely a bug for shmem where the minimum order >>>>>>>> control >>>>>>>> should be order-1 but its currently order-2. >>>>>>> >>>>>>> Maybe, did not play with that yet. Likely order-1 will work. (although >>>>>>> probably >>>>>>> of questionable use :) ) >>>>>> >>>>>> You might have to expand on why its of "questionable use". I'd assume it has >>>>>> the >>>>>> same amount of value as using order-1 for regular page cache pages? i.e. half >>>>>> the number of objects to manage for the same amount of memory. >>>>> >>>>> order-1 was recently added for the pagecache to get some device setups running >>>>> (IIRC, where we cannot use order-0, because device blocksize > PAGE_SIZE). >>>>> >>>>> You might be right about "half the number of objects", but likely just >>>>> going for >>>>> order-2, order-3, order-4 ... for shmem might be even better. And simply >>>>> falling >>>>> back to order-0 when you cannot get the larger orders. >>>> >>>> Sure, but then you're into the territory of baking in policy. Remember that >>>> originally I was only interested in 64K but the concensus was to expose all the >>>> sizes. Same argument applies to 8K; expose it and let others decide policy. >>> >>> I don't disagree. The point I'm trying to make is that there was so far there >>> was no strong evidence that it is really required. Support for the pagecache had >>> a different motivation for these special devices. >> >> Sure, but there was no clear need for anon mTHP orders other than order-2 and >> order-4 (for arm64's HPA and contpte, respectively), but we still chose to >> expose all the others. > > order-2 and order-3 are valuable for AMD EPYC (depending on the generation 16 > vs. 32 KiB coalescing). > > But in general, at least for me, it's easier to argue why larger orders make > more sense than very tiny ones. > > For example, order-5 can be mapped using cont-pte as well and you get roughly > half the memory allocation+page fault overhead compared to order-4. > > order-1 ? No TLB optimization at least on any current HW I know. I believe there are some variants of HPA that coalesce "up to" 4 pages, meaning 2 pages (or 3 or 4) could be coalesced into a single TLB entry. But I'm not 100% sure on that. > > But I believe we're in violent agreement here :) >