Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1184368rwi; Fri, 14 Oct 2022 14:20:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Q0n4/AwKpfU57mhJSlnnogg9YMpuh3yvJrUCcdfUrI/UULgKBvnsKTY2v/sVIsdFb7m3k X-Received: by 2002:a17:906:5a60:b0:78d:b9c2:5bcf with SMTP id my32-20020a1709065a6000b0078db9c25bcfmr4894420ejc.602.1665782444397; Fri, 14 Oct 2022 14:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665782444; cv=none; d=google.com; s=arc-20160816; b=WuZCxpnmmcPon52KUkie+LdXlavx9cDp7aLu9mEBGeykc+3lbJtiQWN4NX43EIAx57 ayJAjBz6maJSefMiYbeTaixHnjfnTDFNjzRHyva0uaZX0UWs2S2AToh3xhSBKVxmCrlY ySqCLUBXbYVwmnePffIr+agBz4NmbojX4PWFOi7wECO1m4OFQXxNgk+RCi6ZKkS5Qwma Bs+o5i2pPB+5qucHCsRZbCyn0F8lIIuLmCoosaOvnZEJeOVmT/VQpMJedglqmNU984oZ uhZutSwZ/dUEhvE/5rbnuwM8K9h9EtMVg7r+30NI0feH+HM3VjBzW7e85Eotb0/Vx0Qk 9row== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ok9hI7NWTIZgdhkAUpeBmH2n5gbA7izg6BGKrFBe8OQ=; b=TCv/+EnWupy3B/ofFaKlqChFctcsgjKfvoDdU+gcz+7vjZFNPB/G1sbQkUDUURQC6D bbwVfzSK9e5EUSEZZbiWzDV9M7iH0Z7/HrBJlsPJSkq0u6Goxx9mc29YQsj+PJfXNd+c x95LRUlNBGR/qqIeZsg772OsYShk9ke4OGk2MJRPAp6iTYmGh4RTUDKo/QVTTb6rQVsB HwE4Q+WyTFuXgrjagE9VhniHcq5MwGTlxygJKO/YLRv4nAMn5wUjllGqwrZq8yDPF0/0 +YoUZjFYIRfEh1GgCCJzIv0UUdtGbK38UHWySkBrGBqiXV5ShpefcUqX+D+4AdGhr4BJ 4+yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="W154eT/T"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp5-20020a1709073e0500b007413ed9efb1si3704025ejc.543.2022.10.14.14.20.17; Fri, 14 Oct 2022 14:20:44 -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=@linux-foundation.org header.s=google header.b="W154eT/T"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbiJNUoy (ORCPT + 99 others); Fri, 14 Oct 2022 16:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbiJNUow (ORCPT ); Fri, 14 Oct 2022 16:44:52 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2237412D26 for ; Fri, 14 Oct 2022 13:44:48 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id j21so3258202qkk.9 for ; Fri, 14 Oct 2022 13:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ok9hI7NWTIZgdhkAUpeBmH2n5gbA7izg6BGKrFBe8OQ=; b=W154eT/TZJ/Um3zPanjrRhXY2pLXsL9jKejRbUCB1J2vdK5oh1Isoe/nekoKT5unjV EbYVGH/jfqWTYYQK893YdbBgeRxM5qz5IOmuXWlNSJi9HjEpwYn8jgv2grGjq4ECS3od 1CtpnizpM3wcmhKpwP02l/aRc2lllihNBu7Hk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ok9hI7NWTIZgdhkAUpeBmH2n5gbA7izg6BGKrFBe8OQ=; b=ocMYscf1jF3C6tE0w9IByYJGUaq1v6k572moSwX72rwAJBdXvSII4HuCaJgHhZW0SD HSEjQ+AGj+lGdMreLcy+QvgH/pBAgacn25j/rMvvIGnte6BQ/e7iBhZpgIbGGaxLEuef wJUUx8Iqi2zZHiHI5SyooAn/XHj+xjaMfuC9LE910AE541H94gPFfZgZbGv1gM4Hb4bt MNCpMtvNyW9SWvQlxtxiwOOiOlqbc0j2wABK2WghUrNvrJkr5+faRnXl31k6UfV6eQ7f 52kQMJv/vUMQ6LknjNc46fChJ+7+BqIZ/nY/pjXnOBESnEehvF+pI2+Bbd79E+U+5PWf lLDA== X-Gm-Message-State: ACrzQf1bAT9ofeddnQ1IGi5+RpXsXuv5RkaHBsQFNRcUJTl5/WJVKTuB FK9KMhVKMoJLsIJVPES0pBjoqhwea1YALw== X-Received: by 2002:a05:620a:b87:b0:6ea:d354:49b9 with SMTP id k7-20020a05620a0b8700b006ead35449b9mr5196217qkh.384.1665780286760; Fri, 14 Oct 2022 13:44:46 -0700 (PDT) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com. [209.85.128.171]) by smtp.gmail.com with ESMTPSA id s8-20020a05620a254800b006c479acd82fsm3376697qko.7.2022.10.14.13.44.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Oct 2022 13:44:43 -0700 (PDT) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-360871745b0so57055297b3.3 for ; Fri, 14 Oct 2022 13:44:43 -0700 (PDT) X-Received: by 2002:a81:5843:0:b0:361:2d0:7d9 with SMTP id m64-20020a815843000000b0036102d007d9mr6405882ywb.58.1665780283206; Fri, 14 Oct 2022 13:44:43 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Fri, 14 Oct 2022 13:44:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN To: Saravana Kannan Cc: Catalin Marinas , Isaac Manjarres , Herbert Xu , Ard Biesheuvel , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Fri, Oct 14, 2022 at 1:24 PM Saravana Kannan wrote: > > Agreed. Even allowing a 64-byte kmalloc cache on a system with a > 64-byte cacheline size saves quite a bit of memory. Well, the *really* trivial thing to do is to just say "if the platform is DMA coherent, just allow any size kmalloc cache". And just consciously leave the broken garbage behind. Because it's not just 64-byte kmalloc. It's things like 'avtab_node' that is 24 bytes, and that on my system currently uses about 3MB of memory simply because there's a _lot_ of them. I've got 1.8MB in "kmalloc-32" too, and about 1MB in "kamlloc-16", fwiw. That's Yeah, yeah, this is on a 64GB machine and so none of that matters (and some of these things are very much "scales with memory", but these small allocations aren't actually all that unusual. And yes, the above is obviously on my x86-64 machine. My arm64 laptop doesn't have the small kmallocs, and as a result the "kmalloc-128" has 633 _thousand_ entries, and takes up 77MB of RAM on my 16GB laptop. I'm assuming (but have no proof) more than 50% of that is just wasted memory. I suspect that DMA is cache coherent on this thing, and that wasted space is just *stupid* wasted space, but hey, I don't actually know. I just use the Asahi people's patches. Linus