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 4A590E75432 for ; Tue, 3 Oct 2023 07:33:15 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DoWi2y1OtHBSMrKKbZ4Ms15Yq7Evc2/QGtha0PIqOys=; b=GD94HC5siNJCle iV9T/lDnkwfsAJCdp8KYNVL3JDzLSw2bs6q5rQ3URfx2WOtHTGEZ6slp9twVq4yqeSiQu4n9kiqwC qnLZJxTrBcmOUZXickR6CHs1tw6cGShcZnKL165sAUfTO9oFJlv8levCVN0DPXDrx3oU/ZNORk1Xs KA7+p9FBwZ7n2oq16qepEYnP1IC6L8fxlvWcZuGKN0M5Do2jzlpD3Uhk5GBSX5V3KlIzRSwuA1KQr QWhPxhEMNkgz8+Hvq1MyUGEyZhueiUk9w6ibcqJ5INlUq7BTz7pO+QA/3Dmdx3p26lXCarhX54moZ RpbEfEC3rf0pFo49vaRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnZtg-00DzqI-2m; Tue, 03 Oct 2023 07:32:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnZtd-00DzoM-23 for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 07:32:47 +0000 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 C668DC15; Tue, 3 Oct 2023 00:33:12 -0700 (PDT) Received: from [10.57.66.79] (unknown [10.57.66.79]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E17F3F59C; Tue, 3 Oct 2023 00:32:31 -0700 (PDT) Message-ID: <0fb0840f-02f0-4103-a6be-eeb4fcc16f8f@arm.com> Date: Tue, 3 Oct 2023 08:32:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 7/9] arm64/mm: Override arch_wants_pte_order() Content-Language: en-GB To: Catalin Marinas Cc: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230929114421.3761121-1-ryan.roberts@arm.com> <20230929114421.3761121-8-ryan.roberts@arm.com> From: Ryan Roberts In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_003245_724881_31219661 X-CRM114-Status: GOOD ( 20.35 ) 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 02/10/2023 16:21, Catalin Marinas wrote: > On Fri, Sep 29, 2023 at 12:44:18PM +0100, Ryan Roberts wrote: >> Define an arch-specific override of arch_wants_pte_order() so that when >> anon_orders=recommend is set, large folios will be allocated for >> anonymous memory with an order that is compatible with arm64's HPA uarch >> feature. >> >> Reviewed-by: Yu Zhao >> Signed-off-by: Ryan Roberts > > Acked-by: Catalin Marinas > >> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h >> index 7f7d9b1df4e5..e3d2449dec5c 100644 >> --- a/arch/arm64/include/asm/pgtable.h >> +++ b/arch/arm64/include/asm/pgtable.h >> @@ -1110,6 +1110,16 @@ extern pte_t ptep_modify_prot_start(struct vm_area_struct *vma, >> extern void ptep_modify_prot_commit(struct vm_area_struct *vma, >> unsigned long addr, pte_t *ptep, >> pte_t old_pte, pte_t new_pte); >> + >> +#define arch_wants_pte_order arch_wants_pte_order >> +static inline int arch_wants_pte_order(void) >> +{ >> + /* >> + * Many arm64 CPUs support hardware page aggregation (HPA), which can >> + * coalesce 4 contiguous pages into a single TLB entry. >> + */ >> + return 2; >> +} > > I haven't followed the discussions on previous revisions of this series > but I wonder why not return a bitmap from arch_wants_pte_order(). For > arm64 we may want an order 6 at some point (contiguous ptes) with a > fallback to order 2 as the next best. > This sounds like good idea to me - I'll implement it, assuming there is a next rev. (Or in the unlikely event that this is the only pending change, I'd rather defer it to when we actually need it with the contpte series). This is just a hangover from the "MVP" approach that I was persuing in v5, where we didn't want to configure too many orders for fear of fragmentation. But in v6 I've introduced UABI to configure the set of orders, and this function feeds into the special "recommend" set. So I think it is appropriate that this API allows expression of multiple orders as you suggest. Side note: I don't think order-6 is ever a contpte size? Its order-4 for 4K, order-7 for 16k and order-5 for 64k. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel