From patchwork Fri Sep 29 11:44:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13404131 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 DF38CE80ABE for ; Fri, 29 Sep 2023 11:44:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7822B8D00EF; Fri, 29 Sep 2023 07:44:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70B2E8D008F; Fri, 29 Sep 2023 07:44:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55E958D00EF; Fri, 29 Sep 2023 07:44:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3FEAA8D008F for ; Fri, 29 Sep 2023 07:44:55 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 19E854138B for ; Fri, 29 Sep 2023 11:44:55 +0000 (UTC) X-FDA: 81289453350.14.5388730 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf22.hostedemail.com (Postfix) with ESMTP id 771CDC0016 for ; Fri, 29 Sep 2023 11:44:53 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.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=1695987893; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R12DE0IaGz6VExNqcRsTIxpYiYIG/gDiSa9v3a/m4ts=; b=hLZPiOKRd4MuJDpHDKW99EGCPtbcrE11qtonBYgwoF/nusH/S3e/uqHcPRkwXl23xMz4Pi thOLjjiSor1SWygbfjWWI9i7UjAFDM3XIC0DxlzhM8CiCKOCGTmk9l7vn/1Eqq0TftXibP bre8WDosd3gjfUv2fKRswpJfItGFNK8= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.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=1695987893; a=rsa-sha256; cv=none; b=LgCNNxZ9hLWux5oM/SN+5UFmW75vNOD6TD6xTNBhbKWasMspQ2rMZ9M1DTtGWNU9/JTh2Z M6iR6zrT6gn9Ma8JTFc+A2fBy2f4CIfIcob1DCeTUMAbUtBQdEhotdYbMR0wQLE4VTVdaz tqvPGB0c4Z5ltsOz7rOFpBwjBEIcJWI= 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 0EAF31FB; Fri, 29 Sep 2023 04:45:31 -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 2C6323F59C; Fri, 29 Sep 2023 04:44:50 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 7/9] arm64/mm: Override arch_wants_pte_order() Date: Fri, 29 Sep 2023 12:44:18 +0100 Message-Id: <20230929114421.3761121-8-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230929114421.3761121-1-ryan.roberts@arm.com> References: <20230929114421.3761121-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 771CDC0016 X-Rspam-User: X-Stat-Signature: adj6urhp89rwmfy8j39m451tcoczpc8y X-Rspamd-Server: rspam01 X-HE-Tag: 1695987893-565885 X-HE-Meta: U2FsdGVkX185J1NqzJwCWI710aex2F4hXiyU/80kQ+SBm7XCgv+T8p7kBlJ/Skl24o6EngrVkVKC2Xzu5hkE+XYLPI/vGJkrsjnXoFMB5tTkFoB1zD2Uqo5ettmIL4QQ6cr8oDgud7fb54cxAy8gPm5uOc2SUvaw4udcbUuIEY8VrGYIYjWHkrxQy9R5pPOwPNsBURLXqejEjkQK8UT1POU1bLhTyBVi+uMfdSE7jK8OSwbRhwuF6pCo/ndmo87fxSpUUHwcCL1LBd/L+CPYdevfxuJ62q0OWE7/p0XWJLh6HrlyOTC0eSDUZ74E0Saq8Wr16Tl+0SGCinb/R/xsOLmcWnn+crJN2DQY/5DwWqnJDHXOHJhcSYTmilvxYU7OpRSO2kyZ4gFyPLgJZgbBkCRZqlgb1dU3a/XdnMw5ZWepiaSxfYcfu/JF9OyQrlFde7rnYhmyo6VzrU50d0ZAvXp+XY2dmkmladgCLeZi9BxAI+Wa+3+M7DDDXPd9cLQnhpPoZB4DY3/4CuY9aCOLd6AkPQo0DhME4q+bBviA7ZAJOE0hLG0fQZient9z5tWG1RIrQApzUQvCUKGuXFC5+QhhyguUrcv0hG/I+iHwvcIN1ob5TTCQgi10zPH6AgltVIHzRERcoMK3qPmVxHdYPvQrt59kWRTusbvy+xCw38Q0vwueI6ZJGCy9cCuHBnVkdDjynLW+mPw3/RUoWTR6qsZ05ntksyrdIuSvt/mHj6v2K44wqfwLxA4JRmTd8idqcLGdndJZnDhz4pTBZ6na0e15ML6st351S/6jZ7AKvrwWtUeaGjZ3kn32DG1JZhgwlz2a7qR2ooRXIF6MCTq/V+b1uR/CY+JdMiB5BUQ7kv9uhBgICFrAOlSCMJP2tlvk/QGXjFFQ5HFAVwQRmutCJ7KEaCtsCKWsz35CNLX+zaD+PT5OVjPLVeMlFfwGfFoIAmpuKRPNOPqUiHDuvwZ 4AGgIZJY qb1CrYiavbHwiw1xXI87tFSnyBOrwuEc0Me/DxWvO8PaAkpE8aRfp30abCkzvUXxd9MFy2hfCP9Th1+vtqN/oiKfRXu4LEqx9CCuCI75ifgArC2dHP/mPqhjfjAACl4Dr5wYQGWsN0EFwlrBdG+uJUJSSkoGiTPIAJ6k8jhAy46yZD+K6J3MbaI+6glSqhX1/chsLwlVnQV/yTbs6atgz8/6KScGhRFwU6gOy+UROPJxw56TyrueyJaEGcPkNcLqjy5nFXSxMB/RSscUEWvXyO3R/uEAxkB3b1ulQo0pFjdH/QrU= 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: 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 --- arch/arm64/include/asm/pgtable.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; +} #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */