Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp951734pxb; Fri, 22 Apr 2022 15:10:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsnFkUNI6lva2CGHMtuzzqwqdmnsihilsAKIPlDBFeT2kIQ6jG8zZdlK388Z5yXAwq+dRw X-Received: by 2002:a17:90b:4f85:b0:1d2:828f:9860 with SMTP id qe5-20020a17090b4f8500b001d2828f9860mr7689779pjb.54.1650665413806; Fri, 22 Apr 2022 15:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650665413; cv=none; d=google.com; s=arc-20160816; b=DnAZRAo+fiMGtSx9uvml4W1gN/IHZCgfcyFcorZI2YBDyYlMQCAbLO2TAzCruz60ye yyXMlpaUOcsz4OMJZ3ui93dTlSrLGwcvYdFSwZFbx4NP3NalePleTRva0k5KMDxFBs5O WpSaL1X6HKjFEJ8eSplWbCYElVHts32rF6c++5UWBwO6eommIAFDKMzx7cf99n9fEbVJ ppPTHRuKHzbuB74iCm2M/XJU0jWEFTxelCCMw1Yqk/BSvtlhVjldoR5Jd7WsgAKLYEf4 0Rd1iSLItJqKiUOsRbegg5ykokb5xgMsqOW7oP2q3b9o4GoKZNJZLkOiukBtYuEu9HSh UsYw== 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=VQf/c6SFLeLbkhwhXbufAJYZwI77Oi3QbNygfxlLBy4=; b=OnDLLyonBWBYh3ZNebdr+XCrZBL5itUUtMQ5MmEdUu6eMMOjIGCjbdcrlW8bGq/eXV KtuRCoAOTgwhjtlNVfiQ09ZIb/PpGDlB16vfErU+YIIDtVShslnQmAC5ZN8WXh3ogATy cbRvnEEv6Jp/jqBvX2+aksNnZCMWereq7Fa3p3okaM4llWKKuM6GB0zt3s7Q8YkRdofu TAuTNyytxQaGCN2SDpY5l/W70NfXeqGjZMmmzkdUOWzDsnq/2D9ayC90H6ByQJ+bHXvh d2wwbuNwOJDoSggSKsOMNF21H6f8wjU5Mf3migMbT+ilo53Zi7hEdy4/NMygjfWg2KT9 tOXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Nkom6JPj; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q22-20020a632a16000000b0039db957a111si9779142pgq.500.2022.04.22.15.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:10:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Nkom6JPj; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8F52389942; Fri, 22 Apr 2022 13:16:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380047AbiDTTgw (ORCPT + 99 others); Wed, 20 Apr 2022 15:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353156AbiDTTgp (ORCPT ); Wed, 20 Apr 2022 15:36:45 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02723EAA2 for ; Wed, 20 Apr 2022 12:33:58 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id g19so4812838lfv.2 for ; Wed, 20 Apr 2022 12:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VQf/c6SFLeLbkhwhXbufAJYZwI77Oi3QbNygfxlLBy4=; b=Nkom6JPjm5rIdy+ECNM+jePflCglXSUYJ7CZDmOzRAMIROG4MFMgW70DQmc0n29WOZ RiM7dK0nWYcPuGZJVSQSfzH17vt8dW+R8FBVhg60w9CfD7gJqmK93xV5KSRu9ZpjGaHL eeumdg/5zwYLL8Du6jUBRtqtAU29zaZ4nSbtc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VQf/c6SFLeLbkhwhXbufAJYZwI77Oi3QbNygfxlLBy4=; b=nKYei1P2c6AXB2HrJdgcTt9j7OwPwA9rGcmswRRVH5s0n9BP2+l+rI7gjcV4nm0S5P Le6fbblkWCoTXeYWschPbfOoeOV6viNo2CStgaSNWDRB8WcR7cjX7CXOz5tJPjtKKMtM P+TE7TQY6QdPwxeaLr8dFDREKsAFA2FuycoDEewxl0aj6Gyp3gbmS6UYkIqMIBcGYtC5 Gv7rN6BQaaHmKMXyT/7TXj677qT28yy1Ok4I3rNuH3+fmeDpMzEmwkdLRVI8Wc4SBQug fSmSN4WNmB6+7p1z8avv7e5C2sK6Jqt0QIXcwqYGBeoc6Lms3UORpNlp/XKN3Mx7ZbT9 W2hw== X-Gm-Message-State: AOAM530o/YCNRInHJ0owhYjqGTkuMiHFT2q2oZjYBEgTZTRzJY3X21s4 c6VeGqjEqz7DIM7eVOJ5BK9b4byNRgZel6Ucqeo= X-Received: by 2002:a05:6512:228e:b0:471:9022:c4d3 with SMTP id f14-20020a056512228e00b004719022c4d3mr11352430lfu.513.1650483236967; Wed, 20 Apr 2022 12:33:56 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id d28-20020a056512321c00b00470d2987b50sm1368270lfe.137.2022.04.20.12.33.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Apr 2022 12:33:56 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id x17so4766390lfa.10 for ; Wed, 20 Apr 2022 12:33:55 -0700 (PDT) X-Received: by 2002:a05:6512:108b:b0:470:90b9:fb51 with SMTP id j11-20020a056512108b00b0047090b9fb51mr14612420lfg.52.1650483235692; Wed, 20 Apr 2022 12:33:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 20 Apr 2022 12:33:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN To: Catalin Marinas Cc: Ard Biesheuvel , Herbert Xu , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE 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 Wed, Apr 20, 2022 at 12:08 PM Catalin Marinas wrote: > > With kstrdup() modified to pass __GFP_PACKED (as per the last hunk in > the diff below), I get just after boot: > > kmalloc-128 8966 9056 128 32 > kmalloc-96 0 0 96 42 > kmalloc-64 192 192 64 64 > kmalloc-32 768 768 32 128 > kmalloc-16 2048 2048 16 256 > kmalloc-8 2560 2560 8 512 > > So that's probably the simplest approach and using the ftrace histogram > we can add the flag to more places. I agree that this seems to be the safest thing to do, and maybe __GFP_PACKED is a better flag name than __GFP_NODMA. That said, It worries me a bit in that to me "PACKED" implies "no alignment at all". And I could _easily_ see people still wanting to do 8-byte allocations that have 8-byte alignment because it's some kind of private pointer thing or whatever. For "kstrdup()", a flag like __GFP_PACKED makes 100% sense, since it literally wants byte alignment. But what about those "random small structures" cases? Anyway, I'm perfectly happy calling it __GFP_PACKED, but at a minimum document that "packed" in this case still means "__alignof__(unsigned long long)" or something like that? Linus