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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 B40A2C433ED for ; Mon, 17 May 2021 11:07:29 +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 7400A6044F for ; Mon, 17 May 2021 11:07:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7400A6044F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uiZfUIVVtvRUCPvjgRJ7bCHnMzt1ktv67fSnZjcYfxs=; b=gynp0hFdIdAm0fplQvadxnkwd 5Qay9k22Nq42w8kv5rPO6PNkfEvKUCoIy2b4Eu9H4g0wz7LWJsh6xmbg5vx+mWbArC7iKR40lnGzY eG+3pZoMXRe0conm9qiBsdbs/1hmrCgISwSzWJmtBR+J4wpQRWpaWVf+JwHT2G8fDJls4xyC5hMYV phKL3rbwLHhhXsVdsUzsE7JhUTHarExLrFQh919eiFs6a62jFMYiY/zqQ0c+RMy5Qb1EebEYSCSJ+ A6Gm5qHbRQbTNqg4PeGJP2OaZRSkyZACilBynNgldrtKStsoUZlMXO6ZwBnNbHB6FZvfezVwX6Vib nWBTrKSoA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lib3x-00Eg6s-KH; Mon, 17 May 2021 11:05:29 +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 1lib2m-00Efxe-QH for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 11:04:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8Q3apR2Y2Nwak28wW/6pdeqHkZjaQV4maldugUHCsG0=; b=UPdD+lvZigUx8JQoqQL+iV/8D2 dhuTXm9wUl3drJCnTIEmbC7efRVbMW0DGhgTXBAxT3spCs4ORfvlCTo4m01J6vfHheWnnzxuc1nM8 KZqZD6k4r5ivPFuSIesMBbegfBAP1167qBp2ABLbKWuLIxKXJUEHtd1IfOhdnqpGZuhEwSLYMr1YN tHqnCKUxNZqe+iSrEVCN4iE5IxPvyH5Mf3wKa97sJc5uzFKcoYHiYt+weTDVESot2FzoaeqrTblZY qS0sOChliOyoymw7FOobggiJ9eMdTY1/IvDVHRXY+Rg+65FZng975YRCaL6gUwfFVQtP0zNspuiOg 4gFcFlQg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lib2h-00DhZk-0T for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 11:04:15 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BA2D61242; Mon, 17 May 2021 11:04:09 +0000 (UTC) Date: Mon, 17 May 2021 12:04:06 +0100 From: Catalin Marinas To: Vincent Whitchurch Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, kernel@axis.com, Arnd Bergmann Subject: Re: [PATCH] arm64: Make ARCH_DMA_MINALIGN configurable Message-ID: <20210517110406.GA1106@arm.com> References: <20210517074332.28280-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210517074332.28280-1-vincent.whitchurch@axis.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_040411_089301_488811D5 X-CRM114-Status: GOOD ( 14.75 ) 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 On Mon, May 17, 2021 at 09:43:32AM +0200, Vincent Whitchurch wrote: > 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. I agree that we waste some memory since the kmalloc caches start from 128 but I don't think a config option is the right. An option would be to try not to rely on the hard-coded ARCH_DMA_MINALIGN when the slab caches are created but use cache_line_size(). It's a bit tricky as the cache_line_size() returned value may be tweaked by DT or PPTT after the boot caches have been created (see commit 7b8c87b297a7). Another option I recall discussing with Arnd about two years ago was to start with the default 128 at boot but add the smaller slab caches later, once we have more information. This can be just another 64 byte cache or even go all the way down to 8 byte if all the devices are cache coherent. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel