From patchwork Mon Jun 26 17:14:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 113057 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7634772vqr; Mon, 26 Jun 2023 10:18:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PE3R65MUjgLg4f8q5a7ly1B7ObHu/RnR56aDiueXRKlYA9pPY3J/qeVp1pMBvGxLbTuYa X-Received: by 2002:a17:906:d542:b0:982:7505:fafa with SMTP id cr2-20020a170906d54200b009827505fafamr23377947ejc.47.1687799935337; Mon, 26 Jun 2023 10:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687799935; cv=none; d=google.com; s=arc-20160816; b=CkPqGtrgW2FA2kMDJoyw6efwbDpHSKivZxgxz+xmuGxPiOpFkndcDlscpX7kS6N9tu pOoMV4Q4OKOmdiFhO9GtrPR8huRaGHbKKuvVXEaqPiR0655mRbDgnJSJoqSYewrL8C6Q 4tZ6hxnjkY/omzURvYftrZTaob7yf0zhJaKc2X64lN/PuYp1hx568WPzZl57r10xUHgx f5wf0p0mooyXvwHG3iTeYyjIed8cPiPMS47WKAtHPqwQUd6fhz2we1lfSvRNIxaNo8+X eGWK87E/iROML9DHnly7glEVa2b+RyjAHhO8XmcKB7Seo1J7j7PJgN4it3jz8oOcGJ6D fmgQ== 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=6MmZkyfi0JXPji2JdUjitVD1cfMLJ46y/AmVM9gAT7Q=; fh=H2MVjBlipHVEN6kEAh1RDhnPLB9jpPNjGExTmo1/EvA=; b=OA0TucdmyBCC8HSWF7S5YZiNWk8OBdd0/7eqYGmGMrW/S2khS355Nq/JSBlUEdVfyn mXubXW28AsqXsNR2NejUba2MuBwtMO9WVQhe7BtZjVk+WsPA2iv6M+0UVeyFyPNThXqb P7pq7TO2Fo2ZeTpGH99Qas2va6E0q3q7/b4KRA64rAXlLf+GYSWLhb+WE9kNMpA1+BcI XSnWgJfV7BrwQTgkN448Eu2HIwXdm01/iXbbDErW9AW37ZxlAE8G9xVZFFCY6A660Xx0 uIeu3vcygX5BMlmwrE2QZl5M3V+LlndEkzZoMQSGo+61b51xlR87/DU9+XmoHesXzOTd H9Tw== 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 ca4-20020a170906a3c400b009887c7b0206si2972737ejb.632.2023.06.26.10.18.29; Mon, 26 Jun 2023 10:18:55 -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 S231424AbjFZRQS (ORCPT + 99 others); Mon, 26 Jun 2023 13:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbjFZRPK (ORCPT ); Mon, 26 Jun 2023 13:15:10 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBAFE10D5; Mon, 26 Jun 2023 10:15:08 -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 C111215A1; Mon, 26 Jun 2023 10:15:52 -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 D7EBC3F663; Mon, 26 Jun 2023 10:15:05 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-s390@vger.kernel.org Subject: [PATCH v1 09/10] arm64: mm: Declare support for large anonymous folios Date: Mon, 26 Jun 2023 18:14:29 +0100 Message-Id: <20230626171430.3167004-10-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626171430.3167004-1-ryan.roberts@arm.com> References: <20230626171430.3167004-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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769786504817859760?= X-GMAIL-MSGID: =?utf-8?q?1769786504817859760?= For the unhinted case, when THP is not permitted for the vma, don't allow anything bigger than 64K. This means we don't waste too much memory. Additionally, for 4K pages this is the contpte size, and for 16K, this is (usually) the HPA size when the uarch feature is implemented. For the hinted case, when THP is permitted for the vma, allow the contpte size for all page size configurations; 64K for 4K, 2M for 16K and 2M for 64K. Signed-off-by: Ryan Roberts --- arch/arm64/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 343e1e1cae10..0e91b5bc8cd9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -243,6 +243,7 @@ config ARM64 select TRACE_IRQFLAGS_SUPPORT select TRACE_IRQFLAGS_NMI_SUPPORT select HAVE_SOFTIRQ_ON_OWN_STACK + select ARCH_SUPPORTS_LARGE_ANON_FOLIO help ARM 64-bit (AArch64) Linux support. @@ -281,6 +282,18 @@ config ARM64_CONT_PMD_SHIFT default 5 if ARM64_16K_PAGES default 4 +config ARCH_LARGE_ANON_FOLIO_NOTHP_ORDER_MAX + int + default 0 if ARM64_64K_PAGES # 64K (1 page) + default 2 if ARM64_16K_PAGES # 64K (4 pages; benefits from HPA where HW supports it) + default 4 if ARM64_4K_PAGES # 64K (16 pages; eligible for contpte-mapping) + +config ARCH_LARGE_ANON_FOLIO_THP_ORDER_MAX + int + default 5 if ARM64_64K_PAGES # 2M (32 page; eligible for contpte-mapping) + default 7 if ARM64_16K_PAGES # 2M (128 pages; eligible for contpte-mapping) + default 4 if ARM64_4K_PAGES # 64K (16 pages; eligible for contpte-mapping) + config ARCH_MMAP_RND_BITS_MIN default 14 if ARM64_64K_PAGES default 16 if ARM64_16K_PAGES