Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp187499lqp; Thu, 4 Apr 2024 10:09:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWKAcTBtdRwnjqw3fBBKNJ3GXbkbBAFbm/WfC/olRreWUMZVaO4cFV5EOHNlTcY/9xDfYTeiVewU48p5G7ud1nN5PxHSgleeCubTltbSw== X-Google-Smtp-Source: AGHT+IEkZ7r0RmcvjD3ud1VOUbeDCQ5wwZK4ughBNmiODP/bx+ZkFK44lND0t38iuRcX4QILEC5t X-Received: by 2002:a17:906:5d2:b0:a46:e0f6:689c with SMTP id t18-20020a17090605d200b00a46e0f6689cmr1928199ejt.28.1712250546806; Thu, 04 Apr 2024 10:09:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712250546; cv=pass; d=google.com; s=arc-20160816; b=PUlDTd+BIokiuyRGM417+oJjRZh4CBUb5wkZg0yQpyGAtrIRU4obouHCWu5BnW9OSh 3T9zdd3uqc8KtsIQdHNvENIDfhsGnpzhAWtAnuVfzYlvy8X9EIYQI1KUjy9z0SUwJq8z RXUrq2vUpqs4v3FcuS0yrvl83suz7VbgBk65rMr781A/Xo6my3LVanVZOqqCrnG+rq5P YU9KiYNOSYFLWM8AL4NKRpYPLdkB2GkPDPoo0qovrL4qLFj81ILY09ptew3QLghgFD7Y Px2vEptpRw9qGqVmgSIvE7/p0L/xvOuFrxPlugHcZZTtUUfDMcidxjzPRi6U63FI2yaI MYBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=KuDs1drwJi9Z+z9OuWkhK3ckPKS9r4/p1uVUkFqevFk=; fh=isfiEj12TjkkwujYJ+71hhpD3jVaH8ehVV6iM9E0Ql0=; b=QS0bVVW5oLffngCyKZWt6dCZQTGg/EEwNt/TBD2pDyOQ279FPyi89EcuQ5I6pRY6C0 sL4fs/87wBi6oBTzx4BOeR8fzZNIVOs8aCmJrxMUFRmaUz1j4fp3lg8BmR4pi88JRouV 5KNqoc5nrSL/Sz+E/b2zmv9XXiHWvhrKq+KnfVNBdmBwQQwvHV7ta0rGsRAJy+9f/ESz KUNmacU3X1iVAilwa8yr8uC+Z7alyyvgz4z8BSN/FWW26pl17wosOL8nSUvt2QIiFhel OU0f3h3jxI3ixLaEo8ezotKRL+/WK6GfDeaOINwrSPHCjHlIjB/+8S/ag2Hk3/dApJKL Iudw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jC5EaRQM; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-crypto+bounces-3337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kz2-20020a17090777c200b00a4dfb912a21si7758858ejc.712.2024.04.04.10.09.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 10:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jC5EaRQM; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-crypto+bounces-3337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5F9701F22B22 for ; Thu, 4 Apr 2024 17:09:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC56012D203; Thu, 4 Apr 2024 17:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jC5EaRQM" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7794F129E88 for ; Thu, 4 Apr 2024 17:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712250539; cv=none; b=WqpTDFJuwc6hT6xjur3jct0gsks259b25rh0mKguGlCJph5Csx8PbXlAuedjyxN52+Oj0dYepRJgmDIbmVBtmvyz7BgJeZXSsUDGqQ4NazkDB3LLWMJS7m8zy7uzGg460787WUkLKv46BQXeXqDPK8eBLGxVMktsko8E0S925uY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712250539; c=relaxed/simple; bh=qIeHxQSzEKN+T+ZMX5PFicsmdKmy6EfcZQYdz44LOBA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YHv0JIEMhOmecHQWz+Vfjm4iHLZ1i/vN4mCT6AWDQ5ZGITkz8pCMfgWOCmRvp1HoDSPFqjh0CKbvM0birW6sgmMQUIzG7LhXmCc7mL0gyu7Tc0YOtSNilbYNnmrJjdGKKtor+xtXAsjikYoFZm+95AegTnfbaZWwCThILTzEEzk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jC5EaRQM; arc=none smtp.client-ip=209.85.219.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-yb1-f179.google.com with SMTP id 3f1490d57ef6-dcd9e34430cso1467224276.1 for ; Thu, 04 Apr 2024 10:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712250536; x=1712855336; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KuDs1drwJi9Z+z9OuWkhK3ckPKS9r4/p1uVUkFqevFk=; b=jC5EaRQMXoWxXcT/PNqSjrcsftwnvseB5AtKBg2vqgAyyLVQgp20SRegZq7YLIrdO/ HTQWScQM/DW37R2IYh+dwMOL2ayL0pQIQzYyP1lXQTLRA97VQiYJ9PHXRyMfJ/Z9ZvVJ oFpUWCWEB1bSpDEyqEQ7RCqnI1td28ZhCzX2yYyMeaCp+6hQUqHZ6EtZjij0pKovvOgy stCx6Jb+d1gT/UvnialtOoZLUIi5qkRs+J/dXYzAxsZr67uO7BH+bPTh4Ub09lLJuNIn 17mjFsnILx+0qC4dxBW5VMWwIa7xznM4mAxRt/Jwv9KrNYGo+0DSWcP592JJrWie/m+S e2vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712250536; x=1712855336; h=content-transfer-encoding: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=KuDs1drwJi9Z+z9OuWkhK3ckPKS9r4/p1uVUkFqevFk=; b=CrXJjlM5h0bYayJHAjPYiURbh32Mqrm7MBkU1tjLecCy9OOt1+aDrlU6pw/qzl0LEU NkJ4Fe9oRSXHkv94Hy0TfXMGG/QOEKrcdwfQkjGVLZr01zTDEj/Cl+UWSsk+25+fqlIA ZMbJBYLen+uR5Jg3/agL3iYfcOe+NqKGcgMgkVNFWapJA+PfNZFHitivbxF9aNuqolKD PI/n4yEtjKOiAcsZSCJ8w97bPfGpz574cnPQl6bawQfSJ3yt7jhZdewrDimdsWgjmLF5 xcbVpnV4NPvH+QggZXh9kLK0iJROurbxrZ0emX8Lt/587Nv4+ubo5NPoZ11Jybblxb21 X5Fg== X-Forwarded-Encrypted: i=1; AJvYcCXCWjmZJ+stgM1bHBpN9WsHUftRkZtiJbYPIRh6NiDa5HjIRKptVVTOYcTS+ljO/e6RzBohTon2wChj5OedotbY7bzzageg7g3X6xKX X-Gm-Message-State: AOJu0Yz//cauhr8lpezQtho7KTFQactvnfyWIP8OquDarVftXty7phSt ctehzxbcIgEMoQjb/bRajf0QynHodHXiJndNyEiKE0l+fV9xtm2KHycoeyCZ1avt+iSOegiuYzp S925emPF69KNYChtSUY0QhnqRtuW8umhpWsNN X-Received: by 2002:a25:ac19:0:b0:dcb:b072:82d5 with SMTP id w25-20020a25ac19000000b00dcbb07282d5mr3065164ybi.64.1712250536330; Thu, 04 Apr 2024 10:08:56 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240404165404.3805498-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 4 Apr 2024 10:08:45 -0700 Message-ID: Subject: Re: [PATCH 1/1] mm: change inlined allocation helpers to account at the call site To: Matthew Wilcox Cc: akpm@linux-foundation.org, joro@8bytes.org, will@kernel.org, trond.myklebust@hammerspace.com, anna@kernel.org, arnd@arndb.de, herbert@gondor.apana.org.au, davem@davemloft.net, jikos@kernel.org, benjamin.tissoires@redhat.com, tytso@mit.edu, jack@suse.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, jakub@cloudflare.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, bpf@vger.kernel.org, linux-input@vger.kernel.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-security-module@vger.kernel.org, kent.overstreet@linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 4, 2024 at 10:04=E2=80=AFAM Matthew Wilcox wrote: > > On Thu, Apr 04, 2024 at 09:54:04AM -0700, Suren Baghdasaryan wrote: > > +++ b/include/linux/dma-fence-chain.h > > @@ -86,10 +86,7 @@ dma_fence_chain_contained(struct dma_fence *fence) > > * > > * Returns a new struct dma_fence_chain object or NULL on failure. > > */ > > -static inline struct dma_fence_chain *dma_fence_chain_alloc(void) > > -{ > > - return kmalloc(sizeof(struct dma_fence_chain), GFP_KERNEL); > > -}; > > +#define dma_fence_chain_alloc() kmalloc(sizeof(struct dma_fence_c= hain), GFP_KERNEL) > > You've removed some typesafety here. Before, if I wrote: > > struct page *page =3D dma_fence_chain_alloc(); > > the compiler would warn me that I've done something stupid. Now it > can't tell. Suggest perhaps: > > #define dma_fence_chain_alloc() = \ > (struct dma_fence_chain *)kmalloc(sizeof(struct dma_fence_chain),= \ > GFP_KERNEL) > > but maybe there's a better way of doing that. There are a few other > occurrences of the same problem in this monster patch. Got your point. > > > +++ b/include/linux/hid_bpf.h > > @@ -149,10 +149,7 @@ static inline int hid_bpf_connect_device(struct hi= d_device *hdev) { return 0; } > > static inline void hid_bpf_disconnect_device(struct hid_device *hdev) = {} > > static inline void hid_bpf_destroy_device(struct hid_device *hid) {} > > static inline void hid_bpf_device_init(struct hid_device *hid) {} > > -static inline u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8= *rdesc, unsigned int *size) > > -{ > > - return kmemdup(rdesc, *size, GFP_KERNEL); > > -} > > +#define call_hid_bpf_rdesc_fixup(_hdev, _rdesc, _size) kmemdup(_rdesc,= *(_size), GFP_KERNEL) > > here > > > -static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags) > > -{ > > - return kmem_cache_zalloc(jbd2_handle_cache, gfp_flags); > > -} > > +#define jbd2_alloc_handle(_gfp_flags) kmem_cache_zalloc(jbd2_ha= ndle_cache, _gfp_flags) > > here > > > +++ b/include/linux/skmsg.h > > @@ -410,11 +410,8 @@ void sk_psock_stop_verdict(struct sock *sk, struct= sk_psock *psock); > > int sk_psock_msg_verdict(struct sock *sk, struct sk_psock *psock, > > struct sk_msg *msg); > > > > -static inline struct sk_psock_link *sk_psock_init_link(void) > > -{ > > - return kzalloc(sizeof(struct sk_psock_link), > > - GFP_ATOMIC | __GFP_NOWARN); > > -} > > +#define sk_psock_init_link() \ > > + kzalloc(sizeof(struct sk_psock_link), GFP_ATOMIC | __GFP_= NOWARN) > > here > > ... I kind of gave up at this point. You'll want to audit for yourself > anyway ;-) Yes, I'll go over it and will make the required changes. Thanks for looking into it! Suren.