From patchwork Wed May 31 15:48:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13262464 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 C0058C77B7A for ; Wed, 31 May 2023 15:49:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 552F08E000B; Wed, 31 May 2023 11:49:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 502D78E0003; Wed, 31 May 2023 11:49:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CC608E000B; Wed, 31 May 2023 11:49:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2DF3F8E0003 for ; Wed, 31 May 2023 11:49:34 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8AFB6AE2CA for ; Wed, 31 May 2023 15:49:30 +0000 (UTC) X-FDA: 80850984900.13.93AFD87 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id A2BBC4001D for ; Wed, 31 May 2023 15:49:28 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685548168; 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=Cf1L6WmjPMAYm9aSbUscBDbAibSbBWO2SXPG1VqERas=; b=lZL77tzWDMoP//yBjvTw3zz0n/N9i+kOCfIWR5UmrkgHwpHAsn7p380RvK8R2d1MfZYloJ YwDJm0o5TnkzxXhw6OO+eSW6xsltqNWa7wBwEjg3slgH/1/VHz74Vns2xwvPlRYia9OEo+ rE071srPyJLvLSlTerNmbqCrCcbjTEQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685548168; a=rsa-sha256; cv=none; b=OLd1Znalbg5rM8M/27I/GGi5RxLYNii1ETTNMoMDRwnNbwAaZFkvDrKZebOWx0+g10U4eU XXwWc4rgy+rngWkyzlUjynm4mzdL6RO734tjUIFQn3XgEoC01O/R9RsJEOdDGcbREaZK3a AqspcYZOTLxPfwjypUPaZxfHrBhaJ3Q= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF7E063DA3; Wed, 31 May 2023 15:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CE58C433A8; Wed, 31 May 2023 15:49:23 +0000 (UTC) From: Catalin Marinas To: Linus Torvalds , Christoph Hellwig , Robin Murphy Cc: Arnd Bergmann , Greg Kroah-Hartman , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , Alasdair Kergon , Daniel Vetter , Joerg Roedel , Mark Brown , Mike Snitzer , "Rafael J. Wysocki" , Jonathan Cameron , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 11/17] arm64: Allow kmalloc() caches aligned to the smaller cache_line_size() Date: Wed, 31 May 2023 16:48:30 +0100 Message-Id: <20230531154836.1366225-12-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531154836.1366225-1-catalin.marinas@arm.com> References: <20230531154836.1366225-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A2BBC4001D X-Rspam-User: X-Stat-Signature: y38wkjapibpn1cthfbc5erkc6x1g6e37 X-Rspamd-Server: rspam01 X-HE-Tag: 1685548168-949582 X-HE-Meta: U2FsdGVkX1+PKug+khGGY2ZCjC7kD7DUoAwg9HKVqWUb5DxLN7IzKZk31r5SewLA38cVavr2pR+8e7WhklxROF7FdJr1cUkuvJVPQxtikM2bzJJvNj4xJqRFvPdis9IZjlfRJS7stHFhU4xqXDcb5wYWvUOeC+Murq9o8bRb4MjU2BVL/OvGOPzBjRJCu5SbDG1eto1EhTRrK8/1im1x+Aty5i+S65BZjtygNZiNDESGgbI6UIMIBJPgeYJ88w4kVBCN1PtLeux4+EbHJhG2LJMCHN8dGLL1c6lAXQxf/eapXvSVj7nH3PW6z1j46t6zc5vFTmiVpIW1L8sbJrtT7l1zLpVKQ7HMiACnNBsmpGsQvG61WC5vY/5uUJN2NbguzmfjOzlh7lUZxzpaJ6e0N0ZIaKplvh3K1kORUcNK+gbLxRxPSnm5dDZO9JG1YcWE1qR6TK98V3eti8VOksySKorZZeNZDEj+M1ZL+iLywHcs4MV+XvbUD0GBqPkTo+mvMjGMIFHaUT80wJIM65BgPlh4mrSaFcOTSQ+lULudzUyVdZlcNOtQW1gqeelCQ5aI0VvoChi+AH/QE/+iMPBvMxKGxsVUX1FI45JjJ+1Q1ZUD5dmjkVzOCx0T2E3hy5WaIhqz+zThuD7IXaacL0hMDQX9eASybOBwvadALs3J0asRY2js7NwVuXjsCJNZjPFZQSwUhFsS0CgkUduKefAAmiQgCXCCd4xFEeKFDOLD+apvh4ugAzkiH8+S0tWWX6YlUcYlamahKBvy5YQSFUDe8LXxQGPsj3xkQQhUWo8md79wBDJOtc9o/dHrJzMKC4loPTMT4qW8uh55vkafQT9QqBAc9nWtmO9Jx9vPXF0WL4I6G2u2Pz7NeoTApkHsp1hEU2OqT58fNNjHvIy6wUR9q6GIIEb9T+FM+zH/FE+y91PsmKnzO02IuRb1AY9yvWl2EzjaKwLkidR/cimg/e4 +wgmJD+f 46Q0hRpZLqL4XEAyH0qnQX3Bnf74k0ReJ3BJNadWWx0cPT67zP0pHOHyU/GS55bG7MWvZ+eFwTmnoetXP2I47dsUd6GkNEhOH5VJJafxEvb0ZXMYbxhrvWu0EpDJDPTPviDSLAlFWT6NN2Ymz4l+k25OODY42il83IA5NSc0iC1ni+rB1ToKYM7l1BRAWSKYSoWDiSW0J0DW8NHaDXvDpqNvckSYbtdcvbp+8h6Mk/7wmgNqRdyBb5LsXLAxVglXM0KAZBcAyVBzcbTRixtNVg1qi3cxd2KO2ZJtwqd9+YxsJl/1E05UF2DG+RZztgkHx4Pq9oKruImZUIIn2/G7NfXBpjxib02hEav8iR8AORBEBGxviw1iuKQMHXPaU/uDAnwkn+SMC/fpTGRRiYsd3HtA/vqznKC8sdclaeKTG9KgdoDYi7OeCEfSmCLqHg2s0YSxozfFxoFDDahplwNNRVMbr5HxLM8AFsmMJv27u4JNzBHyFzZAQI/bMP+mCsJQg9cKQ47KjZu12DSEYW/71APKDY4YJwdDZe791SmrB3jSnLtU5ELdSOVg6vALA9DeJyjxF 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: On arm64, ARCH_DMA_MINALIGN is 128, larger than the cache line size on most of the current platforms (typically 64). Define ARCH_KMALLOC_MINALIGN to 8 (the default for architectures without their own ARCH_DMA_MINALIGN) and override dma_get_cache_alignment() to return cache_line_size(), probed at run-time. The kmalloc() caches will be limited to the cache line size. This will allow the additional kmalloc-{64,192} caches on most arm64 platforms. Signed-off-by: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/cache.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index a51e6e8f3171..ceb368d33bf4 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -33,6 +33,7 @@ * the CPU. */ #define ARCH_DMA_MINALIGN (128) +#define ARCH_KMALLOC_MINALIGN (8) #ifndef __ASSEMBLY__ @@ -90,6 +91,8 @@ static inline int cache_line_size_of_cpu(void) int cache_line_size(void); +#define dma_get_cache_alignment cache_line_size + /* * Read the effective value of CTR_EL0. *