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 9E19FC4332F for ; Fri, 14 Oct 2022 20:44:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C19A76B0074; Fri, 14 Oct 2022 16:44:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC9026B0075; Fri, 14 Oct 2022 16:44:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A43496B0078; Fri, 14 Oct 2022 16:44:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8EEB26B0074 for ; Fri, 14 Oct 2022 16:44:48 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2F8D240F2E for ; Fri, 14 Oct 2022 20:44:48 +0000 (UTC) X-FDA: 80020733856.12.560A83C Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by imf11.hostedemail.com (Postfix) with ESMTP id CC75840032 for ; Fri, 14 Oct 2022 20:44:47 +0000 (UTC) Received: by mail-qt1-f172.google.com with SMTP id cr19so1187261qtb.0 for ; Fri, 14 Oct 2022 13:44:47 -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=G59hazqrfkyIVSXdO3TjBmG0AnQwoYXfErhBbxfq8JOXkIyzouHcSZWG+cvjAf7s5D 10v88BOenjO5CYXQfXL2zqrtBV9SlbQT49+KhdtgY4YBOfJEBsf0XdwyJj1h1JlAsn7C +jRCznqkOZznQ2epAV+P3Ycj5H3ktseIX6EXGyutAgN9yuqjrGDXHNNJBpU7lQ424I/Z 6S8ZbmKdR84QM1XDFroScxzWTZLMg0wlGhp5MCXBzzjRYL4l6SK1iDQmf6TFvF7r++yE HCYr9yXjsI8Q0GB/iZwa8T7akVuhHPxFveNIiPKbUWJh6doKvRuhaQYFCmeSlNpaILxa Gg+A== X-Gm-Message-State: ACrzQf2FMqz7zJrN/6IjogPwfiJKa/bVXU0kvpXJTNNCqOx+j+/hIZ0n /Ek49L6+NK0kD0IAAt3kMxCc/5ieKvOMSQ== X-Google-Smtp-Source: AMsMyM6gQAkeH1TGXoZOy7mWFDswxHu9+4IoO3OOh4zcsmDrjXtDwLZxydKU6WuCz2TRM4rVcmqsDQ== X-Received: by 2002:a05:622a:1183:b0:39c:606d:1f7f with SMTP id m3-20020a05622a118300b0039c606d1f7fmr5850725qtk.313.1665780286540; Fri, 14 Oct 2022 13:44:46 -0700 (PDT) Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com. [209.85.128.174]) by smtp.gmail.com with ESMTPSA id bj33-20020a05620a192100b006ecfb2c86d3sm3019286qkb.130.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-f174.google.com with SMTP id 00721157ae682-35ad0584879so56848267b3.7 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" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665780287; a=rsa-sha256; cv=none; b=Ve6fDFJDdD4bKuztfZq6fTT4Dnn60Da8ulZIwr4XOgQ9grVQgy0Dv/Uu71ip8tt6vPZo6p MiGsKVqsDpg2+SWgAfaQ2w+v+71oWw1cCT+hqNOxf9JMf6qeRTlcAJ4kmrIEUibmTX3tvU udcy+2g2tHNimPPXiPsPt7pwW/fN6U8= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b="W154eT/T"; spf=pass (imf11.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.160.172 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665780287; 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:dkim-signature; bh=ok9hI7NWTIZgdhkAUpeBmH2n5gbA7izg6BGKrFBe8OQ=; b=CVUABkNTIz+KJ0DDJbZOELddUzISYYXHC22RTKHEubNiJ3HnnYoeHIQsmhDbb/3nSYpejI LS4WYz+qLhXjpnBjlBVL30lvs9OJ9vYCpQbvWw8Oly6jXFn0/OcmZmmhbMPvzHJwVD5aTZ viil1cogjssLBeyFq1taX51i0vNPrXs= X-Rspam-User: X-Stat-Signature: zyu9ina8kgd1cb8e466kgheg9i45n48e X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: CC75840032 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b="W154eT/T"; spf=pass (imf11.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.160.172 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-HE-Tag: 1665780287-904935 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 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