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 48164C433F5 for ; Thu, 14 Apr 2022 05:39:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 645896B0071; Thu, 14 Apr 2022 01:39:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3DE6B0073; Thu, 14 Apr 2022 01:39:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E3376B0074; Thu, 14 Apr 2022 01:39:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 400136B0071 for ; Thu, 14 Apr 2022 01:39:01 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1583D6177D for ; Thu, 14 Apr 2022 05:39:01 +0000 (UTC) X-FDA: 79354380882.13.737D590 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 7D746120008 for ; Thu, 14 Apr 2022 05:39:00 +0000 (UTC) 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 6641A61E29; Thu, 14 Apr 2022 05:38:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49332C385A5; Thu, 14 Apr 2022 05:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649914738; bh=EGbkB7EyGIphnUo8cRrJq675aEDUsCnVi4Pkg2u+IpI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U/5xlB2FGJQ4d9YonjZ1eh/VOSVq/JGZbcaKEVZ/X3gneeL6e+c8n4oWQVEM2nC37 NUC4dasWX2knhep41oieB/4y70NBWjonRL99uQmXxgCzCTu04LVcoNKtRdt9zuG80Y UfyeJhMFJLi5uXjds7FMprNpoWpIZbZFFw7DiC/E= Date: Thu, 14 Apr 2022 07:38:56 +0200 From: Greg Kroah-Hartman To: Linus Torvalds Cc: Catalin Marinas , Ard Biesheuvel , Herbert Xu , Will Deacon , Marc Zyngier , Arnd Bergmann , Andrew Morton , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="U/5xlB2F"; spf=pass (imf29.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Stat-Signature: gswnuxwp9uga6mo39xannambpaq31fuy X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7D746120008 X-HE-Tag: 1649914740-547505 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 Wed, Apr 13, 2022 at 09:53:24AM -1000, Linus Torvalds wrote: > On Tue, Apr 12, 2022 at 10:47 PM Catalin Marinas > wrote: > > > > I agree. There is also an implicit expectation that the DMA API works on > > kmalloc'ed buffers and that's what ARCH_DMA_MINALIGN is for (and the > > dynamic arch_kmalloc_minalign() in this series). But the key point is > > that the driver doesn't need to know the CPU cache topology, coherency, > > the DMA API and kmalloc() take care of these. > > Honestly, I think it would probably be worth discussing the "kmalloc > DMA alignment" issues. > > 99.9% of kmalloc users don't want to do DMA. > > And there's actually a fair amount of small kmalloc for random stuff. > Right now on my laptop, I have > > kmalloc-8 16907 18432 8 512 1 : ... > > according to slabinfo, so almost 17 _thousand_ allocations of 8 bytes. > > It's all kinds of sad if those allocations need to be 64 bytes in size > just because of some silly DMA alignment issue, when none of them want > it. > > Yeah, yeah, wasting a megabyte of memory is "just a megabyte" these > days. Which is crazy. It's literally memory that could have been used > for something much more useful than just pure and utter waste. > > I think we could and should just say "people who actually require DMA > accesses should say so at kmalloc time". We literally have that > GFP_DMA and ZOME_DMA for various historical reasons, so we've been > able to do that before. > > No, that historical GFP_DMA isn't what arm64 wants - it's the old > crazy "legacy 16MB DMA" thing that ISA DMA used to have. > > But the basic issue was true then, and is true now - DMA allocations > are fairly special, and should not be that hard to just mark as such. "fairly special" == "all USB transactions", so it will take a lot of auditing here. I think also many SPI controllers require this and maybe I2C? Perhaps other bus types do as well. So please don't make this change without some way of figuring out just what drivers need to be fixed up, as it's going to be a lot... thanks, greg k-h