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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C4DCC77B7A for ; Tue, 16 May 2023 17:19:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7D4E900003; Tue, 16 May 2023 13:19:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D37A4900002; Tue, 16 May 2023 13:19:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCE10900003; Tue, 16 May 2023 13:19:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A9768900002 for ; Tue, 16 May 2023 13:19:56 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A83341C70CD for ; Tue, 16 May 2023 17:19:54 +0000 (UTC) X-FDA: 80796780708.27.1C2B0BB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id D127B1C0018 for ; Tue, 16 May 2023 17:19:51 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.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=1684257591; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W7K3QOx7ImLNs8W3kmfzgwdN09QchyRc2Gg00n/cd60=; b=TvltOCe8XyZFCifyW8qgkjA1e4jq/Qk1cbzhlum8DaH+DICR4NTvimWYYhlCPkOuzaxEnU TavWoaMAeghyTIjY8Astvzt2HinrwY6XruJC8v81TyzBcRTII/Hj24kBoXEb2aGEd1zFeH GAvHZBi6XBV32H1SvBvftXgCnPCnCAQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684257591; a=rsa-sha256; cv=none; b=C1U3Q/cMx+K3ShMG7OUGK1xebKYEHpB3O71+XB/6NlIFKwSOG1bOGC8nu1CR7u+ZPme9ws OGfjQUzrzt0KlJ8LsDSkzuil6M+kLQ9LDD8NoYxEYZ2NKZ3924P/LH/KME7blbFtZho/Hb xhwx0slj9uirn4Ld/m/tY1lfU4vpW6s= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.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) 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 AFFF761224; Tue, 16 May 2023 17:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C18C6C433EF; Tue, 16 May 2023 17:19:46 +0000 (UTC) Date: Tue, 16 May 2023 18:19:43 +0100 From: Catalin Marinas To: Isaac Manjarres Cc: Linus Torvalds , Arnd Bergmann , Christoph Hellwig , Greg Kroah-Hartman , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Saravana Kannan , Alasdair Kergon , Daniel Vetter , Joerg Roedel , Mark Brown , Mike Snitzer , "Rafael J. Wysocki" , Robin Murphy , linux-mm@kvack.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Petr Tesarik Subject: Re: [PATCH v3 00/13] mm, dma, arm64: Reduce ARCH_KMALLOC_MINALIGN to 8 Message-ID: References: <20221106220143.2129263-1-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: inzyh3bw33xws67q1kt8nyxxaifauf8m X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D127B1C0018 X-HE-Tag: 1684257591-924241 X-HE-Meta: U2FsdGVkX18rEcZswvzWNHDqtcT28+N8sYaluF7qLU1fy1PDHUEZY9qb4OIwq/3EBsjI2suJr5b1Tf6SwFcDaH/rx+a7veCXhhqZtVxCuF8xcHrMkRD7X4LiY384IggZzJ+0N0P6KuuAkTTzmhAtx9Tl19h+IafcNA7m9Bf79b7Q/slCrXWiD8BBBmIvzWY3KUJp+EyIuHyRd0/5y5XZXbzsGFnlZfEJDfbEzY9ZJFe8lvGIRAK7iPhj/+K7d/UlWgzhDHOy2bkslhSv42U8E3nS7/vWNWXQPDu3IX9z0Yhj1dsoDWwaQ3mN9Zbi1Ph0W4UNrhKFuh5mqFae+Wp/qFXfSNQ162JUbRJvxc98ihN84pso5oPuAdf8dTbGaL/tJdGM2j1PufSIKlqGNxskWw8zSyEcvqEPflVYPliNIdJ8Aj+/XvNo8pqc381OAlEBDsJgaNPOct4qnBMiNAkiQSkPCIecJNDFPmzCK1ge495JJc1Y+7BanEPnAAuqAsT13E2lO7F9meaaDrcuQRY7/8UmbgZGSt4/g68/v02z0TvTwD2WTvNZMSURF5dTJj+43rPh4WLsffM48ELr81VnM6f6cQjbh5SOLRTqkV0SPffvu9cgF/omuVHjjkSkPLJz39UwheFhFWl6I+/DKWaWa+el7PBgIeW1AK1SIV78PBHQUisU8JbF8iJaP77pEbzPfOhpvPib03qpu4tsOFE0YYHQqpEGzs+MEe+tiTkBpxf8IUXl9fd8NeKr6AJh1rP2FhVw+DfS8EN9LWRGZrkmJ5DVGUCK9AHOiEy0gsfGqaumljv8CZQVJ+fL9JNUay1peqhOUdR/hzP8XTAr5rf+kHZ1DOf9Wfe7U62OyOSrmR3lrltIFHpI3Z92me83UFXcKEZI/cOyVIFhG3Y1Uf3XLsFyS6tHaViyEGR/Cr6gDEQih5sG5CQd3Y0Tys2ToiNvYaBfe3zWU2ZC1Lh4+0t 6mJNznha flaxSfjUJRhRPv8+4o9q5FHIqrz2r+Q9ZGPU6SWYGnCayGEANv/wJbpKUrdSSTOGiZqJPehR2PdDuV9PvYMKsD/8sHYsLcJEIek9rt1nk3c44YNer1BHNfZoN1aiPOGGgEOdn1AwoG5LKHDnaKORZfn0X1oUWpzP1sjJ5vv5DPBBQ4xcHnYs1cRohTRBk+eh0/bjZByq2uHiq3B4X8eGKcGXE2mQQZUiXWvRRA9GHdEarMzYtx0MzF4LbOfNOFdZu37pTBgMvCunpjxxIPOS8Usy2OFwXB4lW0VrqX7dIS1RZxRHz2D+Penmxgz1oAnT0e1Fe87U4u6eB4jnSIV0Jeki+OQenMEn1CV6e2VfV48b6uitGAq33dhkTgajuAXh93Ss1eTdlAZk3CUGMHIhAZ7ZLlcqV93Fz4f5+TFNs9qNh0ACKweoiyRKvk8+Kru/sPnyx+HZOhkxPffRoXdTvGhkOrQ== 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 Mon, May 15, 2023 at 12:09:12PM -0700, Isaac Manjarres wrote: > On Wed, Apr 19, 2023 at 05:06:04PM +0100, Catalin Marinas wrote: > > I rebased it locally but the last stumbling block is sorting out the > > iommu bouncing. I was hoping Robin Murphy can lend a hand but he's been > > busy with other bits. I'll repost the series at 6.4-rc1. > Hey Catalin, just following up on this. I think it might be worthwhile > to split this series into two series: > > Series 1: Decouple ARCH_KMALLOC_MINALIGN from ARCH_DMA_MINALIGN, > and use the cacheline size to determine the minimum kmalloc > alignment. > > Series 2: Lower the minimum kmalloc alignment to 8 bytes by adding > support for using SWIOTLB to bounce unaligned kmalloc buffers for DMA > transactions. > > Dividing the patches as such has the advantage of lowering the minimum > kmalloc alignment to 64 bytes on many ARM64 systems while the work for > lowering the minimum alignment to 8 bytes proceeds. This provides a > noticeable decrease in the slab memory footprint (e.g. I observed a 15 > MB decrease in slab usage on a device I was using). I attempted "series 1" some time ago and the discussion led to the combined approach (i.e. don't bother with limiting kmalloc minimum alignment to cache_line_size() but instead bounce those small buffers). In my series, I still have this fallback in case there's no swiotlb buffer. I'll post a new series this week (including DMA bouncing) but I'll try to move the bouncing towards the end of the series in case there are more discussions around this, at least the first part could be picked up. -- Catalin