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: 13293238 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 38086EB64D7 for ; Mon, 26 Jun 2023 17:15:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4F048E0005; Mon, 26 Jun 2023 13:15:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFF468E0002; Mon, 26 Jun 2023 13:15:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD1388E0005; Mon, 26 Jun 2023 13:15:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9D8B78E0002 for ; Mon, 26 Jun 2023 13:15:11 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4949714079A for ; Mon, 26 Jun 2023 17:15:11 +0000 (UTC) X-FDA: 80945549622.02.2E01796 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf12.hostedemail.com (Postfix) with ESMTP id 6694740026 for ; Mon, 26 Jun 2023 17:15:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687799709; 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=6MmZkyfi0JXPji2JdUjitVD1cfMLJ46y/AmVM9gAT7Q=; b=tTGs2qSFFdkMNsDP23azLWRXZOY0WwH5wNkrGHHEQvCv0NWJ7QI7YxqOpAqRFGRCujlePc L8dKYUbYE2SpQ9QEZw88C0Pk9Vimnp5QhHrdhjciIEhxeM+Ub9YLxjgbBex39byg3TOf1A JPQ7W1DBECWIMcbCH0yKY8p+ZvDf9Mk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf12.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687799709; a=rsa-sha256; cv=none; b=42nsDS8gHXNHS3oyukwO8QsxLQcB+psLG3LmeI18fzAT+8G1SwiDR1+Zar5kPA5L3Xppch BtUc2/vJ3JcE0qu2Xwdpzkw6TSjpiJF82u3nHiQa6KeQyNnFDdSlts4hbPtm4hkKDFgURd 7TOPWrPznQZVwqu4MLMHFrZYAyE/4p0= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6694740026 X-Stat-Signature: d6i9hb9w4iba3b89ikxr6ikrcw7dygwq X-Rspam-User: X-HE-Tag: 1687799709-304830 X-HE-Meta: U2FsdGVkX1/4lXiPvUvbX8zpVMRHp22R4QNuMdQGzsDm5eziBZdoR91KRLwZZlSGi+oM1ESmScTXcgxA9qI3fePDVcHzAj8ZeoO1TXOz630LNP/tRY7JvhDcwABYpWVECAR35+ZZB9UbFy0gVsJ3NiuCNllzipmjs1ChAhQPEH+9kH9tSzcrjyqRXP4Rr93KTU00fOPcyJYdlzpmdgJwkHW+EovywdB2yDNsX9O98jw6CLOu1RBgNQvuuNY6cp1sXd/rmRMz+Ssj81SvQgxp6pyxK2UvffoxBF3x5RRV4sQG/dKhyC1DWhL7Dim43ogilpNLlKF7Gb+i43Gobh30+Bc9nK4KcdwY95l5SXVy68pyA0wlSwwN7ndqQDeCTwhY2b07bGhgNJsc7OSo/J4NJcOZqtkQfRo/nTzZxe4+2Jqa8LDvpluyVv/RiSym2YKoSVcQZFFTGFtwoqqVGyBoq+2eP4UPHlEWvHh+jaHpUeh2qjaerVGCzHvqSpUhxJWNiIfkv96Ob6vNCQFu9t1rkhXVvBXJkvtSTMaMVH54d63tASgVjP5rzIrIqIg/YZcFG7PDG++QkD2/0RVBl/iVv6Wkvcd6JxZQPxMD07p5t3Nw2B/2aJjjs8WbicjkYuPxpslvWPKDuXs4k2xH2kgpgkRVdwsiDoBF6CHyVDXEQpdeOo3AebRZYHKO+lgu4gUFkc/8HNWvmD1598xdSGQ1hVB8b5a2hphusJcxsS1cJOaImw+mHh802kDukoEyvRnnCe2hZtdo8pbgrnK2KtL0QqPB+HJsnlhPXKzSZ4pE1TfIXcCqa9xWGjzil2nvjP7Zi4j5PS3ChhG9yN+3fo5q0JfZe7tfEqoe4noEI7kmrlfTVDZtc4oFB2C7V5LHyoFjJPaxqvFtBst1VNF4f5x9lKtua0pswzi3+UXOEXJJPd0XA6FyktzBajTjLAIbTy8wukbfNphnhOZP7OF6uSW 2Hhh6OKF Oa3z72gcSTyn6ygGqajIF9mPC9DYUWRaVqEuaHCzBuB97Dh/o1c5wM/gkJmkxe8xEAwsf6GGN+xNS48+l/dpv2f37st0/szHP+kWN+l0K7p9ScJHW/U62TF4VHkuT69ixPRyvZSoFgTqhBN2VNnvtGItzXbLlKvnWlvK6 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: 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