From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA28BC433ED for ; Mon, 17 May 2021 07:46:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6FC1761206 for ; Mon, 17 May 2021 07:46:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FC1761206 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=axis.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=lLmU9GANgj0GDe92jhRocuYS0oQGb4iau82hbJCEW6M=; b=fMyxE09KxpTvCz2h8YKP1irDEi KFpUYI4QY4gZyTyv/bqwP8M2+l0QdyW3tOBtSIU4ygLEp6yGZdrkPYI7fpeoHdhXeaSWmqg5ErbXI g54yHOj8ObrXeFUlRR3NTiRDE+SxBkBYIHdMviNYoPWGVwZN5iCK0I6kH+ysSUkHxc0kemVIV3dz0 tGXMGX6aALHnqEUehi/tJdzjdWb5cVWvFbob18xQkh7CqP6iFg64rJmYSuf8Ankam/ljsvbBGijcK 2oliKQbXXz49dHh3wiP8mP2hwrN1QkG9A7mDoDJD7UdOvNh7OJhb2Jrf52p/Jk/NU2P1wOai5oBKW eAlRI6Qg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liXuu-00E4uX-Cz; Mon, 17 May 2021 07:43:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXuo-00E4tg-F6 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 07:43:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description:In-Reply-To:References; bh=ZrKXyWg4O9GKhfyuL1X+aUO/48jah8ENLvIp4lKSN2w=; b=RHwhdBfuEJ6e8UPSii76Y0qArR RGuCpVYIS3uEtnw1VMj6VbRMls+4myCrw1FIhZz4yAWQAh3FVrXNk01Wfq+EYgtalXol312C3ceTq fbz8K/Z1d1A7iiJ0X6O3WHU+gTyYXzUdRymtpSzueuapUOVW+SFAsqgb4tXJEdx2Jixq+EFrcaYEx xetSS4IZeNBkNT36O70MX114qII37U3jDHTeUMFfbMYKmFNrRim+bwHVBGgJIUcuxulHijMaUQ/P7 KgxG0Y6MXXNMFeux89PVn/R1HY28z8Oc3BsY+kqT+FbqX/CPed3pl0bsefsW6wtlWeFKpnKOxXObN cF2AFVTw==; Received: from smtp2.axis.com ([195.60.68.18]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXul-00DYVS-BG for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 07:43:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1621237427; x=1652773427; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZrKXyWg4O9GKhfyuL1X+aUO/48jah8ENLvIp4lKSN2w=; b=YbpIvSuZA2zijV+slRJ2aFZz1WNAIKZaKGRvBO8rBREJI2Iu1V5q7DBJ TMzKUQNV8TU2XklCpuduDXm1rP0wSnXD/qWgSGKFsD7OcSG7KLbrTi9Sy 2RGjMitYuNJ/dXy051fJ7c5A6er4+wAAloJVGqvanZVLHehHZtd+RAy7o gcCNgOpm3nsB0Nep0rzPGEKrYBoGIP76g/u1CdylF3mPo64IOP+J+Ssxe k18se7B5kbfpzr2O40Pqefju8Et56J9UcxmpiybyXMq8bRHJ5EGbuCCHi DSWUXZ95BVjV7F1YaMzGxkHWhF4Oe4kj+ePSPuZdvdO5SRHfyUguNbqNb w==; From: Vincent Whitchurch To: , CC: , , Vincent Whitchurch Subject: [PATCH] arm64: Make ARCH_DMA_MINALIGN configurable Date: Mon, 17 May 2021 09:43:32 +0200 Message-ID: <20210517074332.28280-1-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_004347_892195_97548EF1 X-CRM114-Status: GOOD ( 11.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ARCH_DMA_MINALIGN is hardcoded to 128, but this wastes memory if the kernel is only intended to be run on platforms with cache line sizes of 64 bytes. Make this configurable (hidden under CONFIG_EXPERT). Setting this to 64 bytes reduces the slab memory usage of my Cortex-A53-based system by ~6%, measured right after startup. Signed-off-by: Vincent Whitchurch --- arch/arm64/Kconfig | 10 ++++++++++ arch/arm64/include/asm/cache.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 9f1d8566bbf9..c8716aa18001 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -274,6 +274,16 @@ config ARCH_MMAP_RND_COMPAT_BITS_MIN config ARCH_MMAP_RND_COMPAT_BITS_MAX default 16 +config ARM64_DMA_MINALIGN + int "DMA alignment for slab buffers" if EXPERT + default 128 + help + Set the number of bytes to which buffers allocated with kmalloc() + need to be aligned to ensure that they will be usable for DMA + (ARCH_DMA_MINALIGN). Lower values may save memory on platforms with + smaller cache line sizes, but may also make the kernel non-functional + on platforms with cache line sizes larger than the chosen value. + config NO_IOPORT_MAP def_bool y if !PCI diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index a074459f8f2f..5fa68820ff57 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -47,7 +47,7 @@ * cache before the transfer is done, causing old data to be seen by * the CPU. */ -#define ARCH_DMA_MINALIGN (128) +#define ARCH_DMA_MINALIGN (CONFIG_ARM64_DMA_MINALIGN) #ifdef CONFIG_KASAN_SW_TAGS #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel