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=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 25C8DC433B4 for ; Mon, 17 May 2021 12:05:39 +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 A03C161241 for ; Mon, 17 May 2021 12:05:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A03C161241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DM9uVifyqo1Vlf2ZOFtEy3eBv/lcWe/uT/rGrKAULZ0=; b=qjwMbNZLafoKz5CGCOkbbDcbu qqHyIc1coHfkU9a91DKxtdkbTUQSJpnRwAPhrLMLRGWLtCjYc3/9xWnH/CXBNIhwyv5SJSqOEtKdy tsg7TRi2ha6kseQsW2hGVI28IaGz7bcgAru0DKZRZPkMbv8N1+bvrZhDZuuP8okDN6aqZAeAPwIcb 9WfO7pTrKNG2gI6Ztp35tqGodNij8wDqPMOoPhIlRp4e4lt969ZvdkVKHBbd4hmuzbxhr/hE/0ZHv erQGzKRwp5go44MVkXA1XeZcGcMrc57yimG8akwySenc5HhV0EeH0T24NmMJPtB0Mai9RKBZj6Zds O3bdD1R7A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1libyR-00EpL6-Lk; Mon, 17 May 2021 12:03:51 +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 1libwm-00Ep3E-P0 for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 12:02:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Hb7kjpRDF7suY8d/VkMAk4aCL0E+4ys2GR04Fw2CUJY=; b=NKKq7qGbuWB71a8WOrLQR/lrZf Cz8s+mU45dRzB1fbI8/FVcj0ywurWKLlIvPfNG1R65sRM+ms9k0JGQ8JJsgpqyqAxBpBn1vYv7Yvy I0W/4JkCk+Y/7VkmHz7+0Aa8Be2uYzCv7/fcclFPxM1T30tdJAVRwTvl7mywPrfC1GC55B3ekccNH UQnNxovMXavPMr4xcPTCMcNknlfI9p6Mjs5DrkoiAva/8g+AmkeHe5NA2uEN/UQowaRuycmWGFkr3 +oU/CVAqMi8FGxUcjyX9qBVTnBj6o8EHDVmGIUFN//RiUs1tO0ndPJyhDRqcuQS08Ao2gUNHqALqN YyyKu9rQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1libwk-00DjuS-9g for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 12:02:07 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8AA81611CC for ; Mon, 17 May 2021 12:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621252925; bh=wpuWWrU0eT/oHlb1qxKOXrEm85hgHQ9G5wLlq0C5juE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YYljT7bVBFjAVCGwGwT52U3S/Jnvxat8QAG0dbkwigr6QYOWy+BgKfvaZK+vnlsWe ialWB7iqZtxF7FowA5ZU5JJkzGddddoiA6RG3VaD2YgPNyLE1XdS9gNoW5oGnQNNQA qWv5KXB8BLOqwklX9pHS+by0KHDxQrxbEzbLi4J+B+ec7g4JDwYDHS7U7aGdkENykp m9uYI5em7L82ja7k954S8wzg1j1vuwGexElbmjn+9XtHScCsw8vbaHvJA7WcjLBHZJ m3SaM4+9i8cI6Sr/CtACZpXgXIMJc3qUZnfXfWOyzcEbntV6rXu4rlalPDGFDSI1/b scpyyBStiSVvw== Received: by mail-oi1-f180.google.com with SMTP id h9so6248322oih.4 for ; Mon, 17 May 2021 05:02:05 -0700 (PDT) X-Gm-Message-State: AOAM5337FklVvBZ6DBdqSt1trZZZdnkFds8vYvPGE2hNltfi7ax0wXAz f6uYIvEadD0Hl3/umKdri3daBVOFn3aBbyXkICk= X-Google-Smtp-Source: ABdhPJxiEg0tHtq+JV9H1mbKepzwJET/Tfic/zmyeXgpN5S3Mvnof93a9sO3+RudLh6q8mQtnjulDjZ0Vhfb8pG+x7Q= X-Received: by 2002:a05:6808:a96:: with SMTP id q22mr3555984oij.47.1621252924940; Mon, 17 May 2021 05:02:04 -0700 (PDT) MIME-Version: 1.0 References: <20210517074332.28280-1-vincent.whitchurch@axis.com> <20210517110406.GA1106@arm.com> In-Reply-To: <20210517110406.GA1106@arm.com> From: Ard Biesheuvel Date: Mon, 17 May 2021 14:01:54 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] arm64: Make ARCH_DMA_MINALIGN configurable To: Catalin Marinas Cc: Vincent Whitchurch , Will Deacon , Linux ARM , kernel@axis.com, Arnd Bergmann X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_050206_380908_8184B35B X-CRM114-Status: GOOD ( 22.39 ) 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, 17 May 2021 at 13:06, Catalin Marinas wrote: > > 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. > ARCH_SLAB_MINALIGN is also used to statically align (members of) struct types, so doing this at runtime is going to have limited effect. If a) ThunderX is the only platform we care about (do we?) that has 128 byte cachelines, and b) DMA is cache coherent on such platforms, couldn't we separate ARCH_SLAB_MINALIGN from ARCH_DMA_MINALIGN? I.e., set the first to 64 and keep the second at 128? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel