From patchwork Wed Jul 26 09:51:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 126266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp329525vqo; Wed, 26 Jul 2023 04:21:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1kow29ThkBreYKTxW0wulKvDd7PhDiGiNRghOaec1+Tyw6HNLjj5wZOCrlyMpFWloGrt2 X-Received: by 2002:a05:6a00:1882:b0:682:4edf:b9b4 with SMTP id x2-20020a056a00188200b006824edfb9b4mr1988580pfh.23.1690370499397; Wed, 26 Jul 2023 04:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690370499; cv=none; d=google.com; s=arc-20160816; b=bUttpEu7/r6B8N6SlpG2IPylctNLb+4mKwgGhg2FJKRD/4bi0ndxrz/5hvAwiyKU6D H92vVSKIXvG01FwRb73UI+vQySUVkg1+ywIIx5f+IizK8p/I+HJ4WakVJnKScoQlxw17 8ayYGaiPM1wDEeBXTQtiTL55b9UlEb6rOiEloZwMV2OHVhlCqutFRmuySxxU2QM9CvAP sM4xdPWRal72Xj0EsnB1St4bCuWes+jGLCPGsES3MTzG8DTzs6bWmeQP/Khr0qDArTCK md+Tooo0cRWArlTQK97LA0trmcvqHpDZUrSa8j4YdWxanPlN3ZN32EhXf9pAJQO+xDRC 3EmQ== 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=iwm9DkoXLBxio5wlQLJ5lOhkwwAE6xJtKQSzoG6WzoY=; fh=7mShmVuH9suBfBzgvZMyGTZzqI3OVCsEZy4ihinIHw8=; b=ht7Aw7jDr9NWqVz29/uM3NqQgcwgtVbV/aM9NCeYAA5HPZnR594PR1mn2SA1mCxjr+ XEutCHODF3ff7meoetGyGvYwsvavsGFAlt/mzJccb8RcUT4s4J9hKsKKC7geJ2XSbsex pE2H1X9AFiSw7qq64vNKKjlk05v2IYIwhkCC5P0JxL6L9iIg9TGaX/XcD9tbs/Q7lVgG kot9v09n3K+wZvofo0u1In1EE4AitmsK0wGTzZbcow3JaeMJskcCcpIXUq1t/hKfaAFT LoKp+8r0KAA3SW9vc+6orG2JabyezVnSEH/qCue49ksdpYiYQzH715SYbIcnb0jKCH2i 6gwQ== 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 eg26-20020a056a00801a00b00686680dc33esi10517258pfb.404.2023.07.26.04.21.26; Wed, 26 Jul 2023 04:21:39 -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 S233804AbjGZJw4 (ORCPT + 99 others); Wed, 26 Jul 2023 05:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbjGZJw2 (ORCPT ); Wed, 26 Jul 2023 05:52:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DDDFB2D67 for ; Wed, 26 Jul 2023 02:52:07 -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 6C4B9169C; Wed, 26 Jul 2023 02:52:50 -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 30CED3F67D; Wed, 26 Jul 2023 02:52:05 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 3/5] arm64: mm: Override arch_wants_pte_order() Date: Wed, 26 Jul 2023 10:51:44 +0100 Message-Id: <20230726095146.2826796-4-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230726095146.2826796-1-ryan.roberts@arm.com> References: <20230726095146.2826796-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: 1772481936635136356 X-GMAIL-MSGID: 1772481936635136356 Define an arch-specific override of arch_wants_pte_order() so that when LARGE_ANON_FOLIO is enabled, large folios will be allocated for anonymous memory with an order that is compatible with arm64's contpte mappings. Reviewed-by: Yu Zhao Signed-off-by: Ryan Roberts --- 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 */