From patchwork Fri Jul 14 16:17:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 120558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2632447vqm; Fri, 14 Jul 2023 09:58:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHmj3UVf+K127jq4tS2RuVv7CIWZZurac0dx3wn+yE8QJh2tJsYsRbYH7mXZZEDNsDECWS X-Received: by 2002:a2e:6e13:0:b0:2b6:fe3c:c3af with SMTP id j19-20020a2e6e13000000b002b6fe3cc3afmr4482211ljc.27.1689353885581; Fri, 14 Jul 2023 09:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689353885; cv=none; d=google.com; s=arc-20160816; b=EMD9ysHm2AGspZvOSZ3oDm8VaHQ8/yL1heSLK4H24jE4f0V+ys1eJLRcSly12Ygrq5 3L7fA+VuMBRrawAou+lnFZE/y8NTQ5eQgAJjTW9vcn0g6/KoXcxiklaUixbmRIZ5RYs2 ZaQlMeFV0zmaCXjA6k4o0FSR9PzAZAH/Pk9kftYdJIMAJgAzU3sCvsCYfvCDTgutHokA L/PrH2dth5UW1TBvKF9/v7ejYqPrUY8OBrjPFWKSfJhYjerbZvXbP+ASRc1E8MzLCwRI 8T/oiQPbDIJpGiAmwiHMEvauttMqNU6iXomaMK1AMepN9urXNB0MpGGWaLjCHBYu+eFy ikAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=71smc1TZNhMZlMSAnG9fgcjZlzgTrk3pagdzxHJYIq4=; fh=KUn9/czOF/CUegSsbpumpb8eTeZtYrbN2VF58YsSKuI=; b=tNV4qJXoEcbiyc/JvOubMYi6SLu8l+Iqnq1OdOn+b8RhtgAjavgmfQMTUeeKYPeBOZ NzTiuvmgL4+WH3dNzLdEZkVDec9yMT83HBPZTn0KTF3jpr6ncBvrs9IPsraLoJ9CKEbn miULVsxbG2fJ7QQQ5Rxl7Tw+YjxfzyKraJQuEbQRSJeiYA0lAsTwgo3iLzFRiuqVVUFM U5V67/x5/BfukGAvFO0fYfCWtcjEKwrfD1fEcX3xSGMhZ6m1BPr7ctSht0d3LVddjBDt 0joX+abhjZb/TiKK/ZFzFO/ec1A7yNSWNiJmkV/kS6LYMm7wiTV9QOqEqIPxT+ewy5MP EXXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a170906560e00b00988be9d8c53si9422009ejq.946.2023.07.14.09.57.41; Fri, 14 Jul 2023 09:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235586AbjGNQSL (ORCPT + 99 others); Fri, 14 Jul 2023 12:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236379AbjGNQRx (ORCPT ); Fri, 14 Jul 2023 12:17:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E96A30DC for ; Fri, 14 Jul 2023 09:17:51 -0700 (PDT) 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 5789215BF; Fri, 14 Jul 2023 09:18:33 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B8643F740; Fri, 14 Jul 2023 09:17:48 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 4/4] arm64: mm: Override arch_wants_pte_order() Date: Fri, 14 Jul 2023 17:17:33 +0100 Message-Id: <20230714161733.4144503-4-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230714160407.4142030-1-ryan.roberts@arm.com> References: <20230714160407.4142030-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771415939662805343 X-GMAIL-MSGID: 1771415939662805343 Define an arch-specific override of arch_wants_pte_order() so that when FLEXIBLE_THP is enabled, large folios will be allocated for anonymous memory with an order that is compatible with arm64's contpte mappings. Signed-off-by: Ryan Roberts Reviewed-by: Yu Zhao --- arch/arm64/include/asm/pgtable.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 0bd18de9fd97..d00bb26fe28f 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1106,6 +1106,12 @@ 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) +{ + return CONT_PTE_SHIFT - PAGE_SHIFT; +} #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */