Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1439515pxb; Thu, 14 Apr 2022 06:20:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzMmXgDMsiyLHuDuhOfF36ztGB2pBUW/zcArpdAkx8oqwb+PEL9TuJ14ifGM9FvP2AMbJM X-Received: by 2002:a63:f515:0:b0:384:1f78:34b0 with SMTP id w21-20020a63f515000000b003841f7834b0mr2277678pgh.67.1649942399786; Thu, 14 Apr 2022 06:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649942399; cv=none; d=google.com; s=arc-20160816; b=Tjh3PXVAc0QzMLhS3S//D2PjIYB7cqLlwL89+YfegxABzy+L1dCCGpz6q6n2xzrFq+ xwq89Z7IQQjV+YJPVeaLZWpP7mLZwqvyvMF4Cb7+ZMSy7M/dFbk6y85iC/OrHeNz8chy KOkNkvAoVBy86/o7ZqfOQTsVaivXwEYbm6oH3UvA0gi/YsUtejMfrRrR7otItWXLAV0h zUZN8ABIaesJo6C4jcW/PHmldM/0qR8jZo2TfPx5rwbZmSFwpXvp988DW/3oCM9EmgIQ MGZf3L/KKKy4d20awNyNzVxBOPwDQW765b1EDoKkKN4TUAMgNw7soIwQab8gebpntgO/ bltQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wGDK/V8QfztxbtmowQnxm3GE1XzBIz+ZZZGmeHCv7Ow=; b=A8sND+SPXGAH4Gg5OuhIoFjOYjLkLn8GthwrjGb46cLtwFqHqrNWT16dZW8dusVOFR 6w8TSztmyOa6E5L3qUHSmmbE049p5m+C+cprL3f7GMIYToJMhVGxYczoWLL6pKau3RU2 XvSQPEBNpq5W/+E9DSz8qNJVlCkUvbfsLfK2mNV07ES2duXrW7ZCLbp65ovfhQi+lgfZ dYsAS3awIciGxv65BtpvfXyoYL/G/BXIsOL7xPTDDAkl94sUZudSNeHf3y6pX5I0jRcR hgHiRolMwsOH/xmeKFcSWz8Ak47/qcaHx/4KLqMtHqs0OZjWPpUz0wDB2IaebERKEhqJ 3xbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U/5xlB2F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a655301000000b003816043ef93si7809951pgq.392.2022.04.14.06.19.45; Thu, 14 Apr 2022 06:19:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U/5xlB2F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239091AbiDNFl0 (ORCPT + 99 others); Thu, 14 Apr 2022 01:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiDNFlZ (ORCPT ); Thu, 14 Apr 2022 01:41:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A3A3CFEA for ; Wed, 13 Apr 2022 22:39:01 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 0A677B82836 for ; Thu, 14 Apr 2022 05:39:00 +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: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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