Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1238667rdb; Fri, 16 Feb 2024 09:12:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWh/CF9PuTbr0jlDZs6QPlJ2ac4D2rhCB0FFMs7C5snFNZN/WRZ9lgJF5MhAmFUjoIP804ryLY1fvkWUFcTWTqDImQyc1Pr9MuWxQLG4A== X-Google-Smtp-Source: AGHT+IGU/HxVlqs4UMfVqgKjirdl6vVlHjgLtHCL/kykUxrs1vB/Za7b1DoD2i7oySm3G8kP+8nN X-Received: by 2002:a17:903:244d:b0:1db:5d07:f8ea with SMTP id l13-20020a170903244d00b001db5d07f8eamr6163142pls.64.1708103564686; Fri, 16 Feb 2024 09:12:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708103564; cv=pass; d=google.com; s=arc-20160816; b=LRI8Up1MmmHiDfmiR6HZyNKh47QBejeCvNov4ewjG84EAuKsjHZtZI75mqlWliQdgx +No+sT2zWzVSGcT9if6XeXiqgZXWOSnVWydAKIg9OnoKDQtm/kV5OAWHeZ5b0HtW03qs W6tDvgAL7v1nU2xOgZZiSy92H/+nDzAKAJZSuqqE2RtC6fUwQyXb5xxKb4wfkMFjpZku IxYObGq6ZYkxl8+GYmv1vW6EAvoRO69WmBSD/MzkAL9NKcYNEUPUkOptw6+OLf/K3/JT /4HF5v7B0AZgW3U8UcIbz0oSh2ZGqwBihaVs4eVmz2aDnB0P4PUp/05ZHoP8zqMiwYuG fxpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=HmJQIqc4/OgO89xq5HkfBIYteF7nE9kIo+o5Vkmf1w0=; fh=oLzH21GokMW2l86dFsMPozOxCJDwxgKqQI1fOLLTHJM=; b=F/CdLDiadjftIpzI6N4nAGhw1JlrM5BrkNM0G8kvcSp+APIyxEYZgzcVz4zFll7DJs wWZw4TC/dLe0ANJorPcSQMAK92R0c4Md9V+Z5fduAs6X4W5sw7hnjUflwIT5/2bEx1ku dNkk7YgMWMfKqTCRUUCWB9tGXYvTvZxPNUKN5VuraiLVu04Bd72VNAcAbaCCiJwJFRXz E7Y0BizszUEbqoJYAcCH4+1GBuVKuqhfJ1JlsjxMMw55YmVIzX3y+YHStPi4dKuBjJ+L trtOiSO9+rxaE4qk7AseJEyew30NmVGsiFuieEemAqjn+KCXo+6/G4kpPCcTU6NdaFyJ /Iwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Sfqp2+ZZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-69009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69009-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z10-20020a170903018a00b001d7562f67ebsi140195plg.331.2024.02.16.09.12.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 09:12:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Sfqp2+ZZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-69009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69009-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2D689B23467 for ; Fri, 16 Feb 2024 17:04:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EBF0130E2F; Fri, 16 Feb 2024 17:04:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Sfqp2+ZZ" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CFFE130E2E for ; Fri, 16 Feb 2024 17:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708103043; cv=none; b=cg8ImHbhPIOCV7bHP6UEfZdXenBjEEXMMSqHQ4P66phnCT2p0VocUxfTWxJKuIYTXNwi38qAjCB9hiCWC4dh9TUMovgm9OHQxwe3K/preKOlQDlgQiHUnczr6WXZVhLdD37z02IfXg0gIaXz9c62Whpnzg5ZfqQ9cW4VR5Ulh3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708103043; c=relaxed/simple; bh=Tm9Sh/qsOAnc+BdDWsSqYDD3wfqtjXBcQ5Oq8JkqoXo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F1qpjBErztca3JsqOTJmqotkKmJDT4s+oE8IYPmhi8vJebD+bP9R++khAW27iGl3a1KhD+bpeqVMMy6qGGHpIDgerlqrf6Wp/Cpi3yy1O8X9ZuQwDU8ppPDntZB6gr5vr/PMQQqD7voh4hyL6tPiYsBSnjkEjqk63cPEM/H3pZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Sfqp2+ZZ; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Fri, 16 Feb 2024 12:03:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708103039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HmJQIqc4/OgO89xq5HkfBIYteF7nE9kIo+o5Vkmf1w0=; b=Sfqp2+ZZDoruaTeHE15NGTvQrR4vxcPG9Isnojl94qpEL7wBG/AIUx9L8x2ZzdD04C4Xko QKE1GYS1wRReUz51hBdQZagUBBoyBvwAx04UnSHcQ28MYep/Re3HUavlqnV7CN74fW6Hzt L4hhIlJhg7UCheW4IzGJzoMdLrgkDvs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Vlastimil Babka Cc: Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v3 22/35] mm/slab: enable slab allocation tagging for kmalloc and friends Message-ID: References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-23-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri, Feb 16, 2024 at 05:52:34PM +0100, Vlastimil Babka wrote: > On 2/12/24 22:39, Suren Baghdasaryan wrote: > > Redefine kmalloc, krealloc, kzalloc, kcalloc, etc. to record allocations > > and deallocations done by these functions. > > > > Signed-off-by: Suren Baghdasaryan > > Co-developed-by: Kent Overstreet > > Signed-off-by: Kent Overstreet > > > > -} > > +#define kvmalloc(_size, _flags) kvmalloc_node(_size, _flags, NUMA_NO_NODE) > > +#define kvzalloc(_size, _flags) kvmalloc(_size, _flags|__GFP_ZERO) > > > > -static inline __alloc_size(1, 2) void *kvmalloc_array(size_t n, size_t size, gfp_t flags) > > This has __alloc_size(1, 2) > > > -{ > > - size_t bytes; > > - > > - if (unlikely(check_mul_overflow(n, size, &bytes))) > > - return NULL; > > +#define kvzalloc_node(_size, _flags, _node) kvmalloc_node(_size, _flags|__GFP_ZERO, _node) > > > > - return kvmalloc(bytes, flags); > > -} > > +#define kvmalloc_array(_n, _size, _flags) \ > > +({ \ > > + size_t _bytes; \ > > + \ > > + !check_mul_overflow(_n, _size, &_bytes) ? kvmalloc(_bytes, _flags) : NULL; \ > > +}) > > But with the calculation now done in a macro, that's gone? > > > -static inline __alloc_size(1, 2) void *kvcalloc(size_t n, size_t size, gfp_t flags) > > Same here... > > > -{ > > - return kvmalloc_array(n, size, flags | __GFP_ZERO); > > -} > > +#define kvcalloc(_n, _size, _flags) kvmalloc_array(_n, _size, _flags|__GFP_ZERO) > > ... transitively? > > But that's for Kees to review, I'm just not sure if he missed it or it's fine. I think this is something we want to keep - we'll fix it