From patchwork Mon Jun 12 15:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 13276867 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 7D454C88CB2 for ; Mon, 12 Jun 2023 15:33:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1668B8E0002; Mon, 12 Jun 2023 11:33:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EF14940008; Mon, 12 Jun 2023 11:33:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF8638E000C; Mon, 12 Jun 2023 11:32:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DE3E08E0002 for ; Mon, 12 Jun 2023 11:32:59 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AE46DA02A8 for ; Mon, 12 Jun 2023 15:32:59 +0000 (UTC) X-FDA: 80894488878.30.4CF50B4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id D96D214001D for ; Mon, 12 Jun 2023 15:32:57 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf09.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686583977; 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=XZxYG1ZyKNCbRegZE+KJoS+5roUkNS5nMBDKAO377Q4=; b=i/kOLcD5+6asDPYaRh5uhE8JckW2VWSCJtzErqiBOjEs63E3VMP6hp4UZrIm3B5S1GFvcI W9u7SJ1e2VuUCB0+rj5z6EoFA25ckjJFFk3YQAyCj7mbTgKM17QArGcIY8s3Nf6c4D9Dga AJtcQ+q4zerI9QEK+YKxPRdhvdo/3Bk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf09.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686583977; a=rsa-sha256; cv=none; b=mf6NGChCoYYmc9DezVKoWe2A9sjKdNRQrdR4p6cx8Rwnp8mpfVZFo2nPWmOk19PEGgLINl MQGfaQKJGdTaiETZRd0LBTo5JWGQGHMZbD30xunrqwfRo5jWcvt4PKLep0oggKnbp3esDr 4RerxHE7cpvunN7g+SB3grTLImk9NqE= 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 E31C762AD9; Mon, 12 Jun 2023 15:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65A00C433AE; Mon, 12 Jun 2023 15:32:52 +0000 (UTC) From: Catalin Marinas To: Andrew Morton , Linus Torvalds Cc: Christoph Hellwig , Robin Murphy , Arnd Bergmann , Greg Kroah-Hartman , Will Deacon , Marc Zyngier , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , Alasdair Kergon , Daniel Vetter , Joerg Roedel , Mark Brown , Mike Snitzer , "Rafael J. Wysocki" , Jonathan Cameron , Vlastimil Babka , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v7 11/17] arm64: Allow kmalloc() caches aligned to the smaller cache_line_size() Date: Mon, 12 Jun 2023 16:31:55 +0100 Message-Id: <20230612153201.554742-12-catalin.marinas@arm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230612153201.554742-1-catalin.marinas@arm.com> References: <20230612153201.554742-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D96D214001D X-Stat-Signature: cto64oq5f3rwnpa7mgyaxsrj7wub9gjn X-HE-Tag: 1686583977-728785 X-HE-Meta: U2FsdGVkX19qDKl9P/OViEOt1vB2Oew2EVBaD9uCmBIEUUT9eQf7DEUgZeFqUjBLIy8wOUTO9NbmmuxyVkRSIS9hRCu8bvvK6ECsSCGSe+pcCfhyDpCK53VcB0vG1IMRs5O1ErITy7TfQDfwJEmE9uQyw4cH9odkfCiTHqihHMYVpFRkLi7hOH9Gw4+2t2PtB9zoxWeEb7DcorlFf+GCqeS84XGViPspjSo7pVP1AA9epSpt1j0TGCh6Wp7/3ON5C3RcAKIQGXajeWq/THFk109Bg8E5KRBXzSK1FJi3BAJzLKmKky+TTakcVV+UpCW1iZcx3cDNV0clb/JgVuVauzVIfsCc2Z81yiZGdosyJY5Mn03nR5rDGe1ngG3mn+g/NNiu67HsJ+3iGDC1imKWswfIHi54788J0XCTdZKzLROXW+I49mHoPV+r0DKC4Zoc/nzgCmz3sh4Il/8822DJFjdMtotbzR2N6qz3vvDVdiVOu4OvwRNDckzghTD1NGio5Jev7JgqUfp/oWASRVRXG9ihd83Vvj0fIhDCKRjtmcbUN53xB1cQ9/Z++X+pg8KMl/JuF77iwThRFMKS4TPdCNOJBhr+L/Acaq4IoBL9Ft0t6URzNUDbxBgFYEOtqoC18ELp8eKqfuPxXGxpdIUfMhuIhYBI8WrHT8r67IJwOO7/GKztSiv7YkG+vFYApGojllWqurSi5geuJTSzX6RjgbWiWkOiIbFNUlyrdEzHHZcjU9Q/z/RtIHEYzfcC52izxoSlCiLaDWdJdj417Tu06SvZhfacJlTR1pX9SqcJ8iL+9qvkVIDicGWM52DCPKusE4xYuZfLZveB132d9bO6PRY0qj7p9FPsI6QsgAT3na7wfYyiUNNfmFfQNU93Z/7D2YG0JQ2llJGFs14rUBy+hO3TEZzAY+2s1w5PEmo5kP0UJZUrjfTzgPxQG+60eObwcyazfjO9adgTk8NUmLe kSa060Fe D/Z65Q9+TJUaNUIJ67sPV2wabW0c+gztJ3Xd489vquudzR8DEOMuAaQzx9AYrm+WQeGK5BMC2kdCY0nLcnMrHWBuzO8zEBP+8PwRUdZedegsAgNt+g/hScFToD1vz/HZTAiVhP68w+RlpZ7MShhMpN8MmVjHiCoJpOp2xapb9iJeUX0GK6Wo6rLFU27lMjKL6LxsCuIz93V8jYQy2gB2IDUOFyTH1rGoU9sz2pY7c/vI9sPF5Bs1Xmf53q/KSJYWAdxepgUPiHEHQDnel0FHF8bjg1P4cdYc0iD+iyC61Oq00crj2yRkH2E75EKox8FwG8sudPaO2mqOQVOqAonBeN8946jEPNTomODwzE95h9WGK9Bwv65Xwaqg6AUKYcqzZNjTv/zh9cEbQbH7Z9NnqBeRlSrKyX8sAZodY1B+WjVa/US0D2dx9uvPQU/oM4SBZa8cYRwvENb/xIitNte95BLuCdDqxAFBusnHolYIA54lc9iq+qFbkLZq4Q5AZvj4Wqz2c0ziDm4zDPb6oHrkm1AajiwDEpqddSWDqbyu3bwS+qKSlkfarVUUHwcynotg3E1ae+sST3ckas7DPY7L51++9aQ== 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 Tested-by: Isaac J. Manjarres --- 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. *