Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2408476rdg; Mon, 14 Aug 2023 01:11:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpshOg+5ghgBQi80ySeXEHgTDHpUmm7dQTuvXBj7GmzBbqU8W9sf5KM4wALkwyGf/NiABw X-Received: by 2002:a17:90b:3105:b0:268:e31b:decd with SMTP id gc5-20020a17090b310500b00268e31bdecdmr7360919pjb.11.1692000668365; Mon, 14 Aug 2023 01:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692000668; cv=none; d=google.com; s=arc-20160816; b=NhUkgk3BPGFhwoyGhzPL+rLidjQWRIZtqeNvJeTQebJCyIeCUdOvofNoMpNYszqFS/ kBPM6wMJy+d1reZGBsG21ikkds00AET98tG9YWosykrd+bwsVNTXGaL0GXsClj14KHZE 8eF+ukNSsylgVJmjEKjTq+rE5NXkooDmgsivneznl22ZLF1QXdvGExiPbNvoejMbfn7z NkrW9fDnEXvPJVMCIkE4A7GZFLXTfmgWX+I+tJPMW/dHKcmKh1FRkYa+i71lChUzPOsl DQS7Ep99sdmOLZAj68jhZAq/G66c7qkbmm51V3HAhenE5sG/vqyPSDDJG+zQlJVBICnF 6G8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1NIpvt4nCqADNh0cqss2ffGGeYbGFw7fYt1kJmUbwbI=; fh=6hFAfrLxXKbPMWhz6N8n/c2lSrj7XV2qNSEtaj0EnYY=; b=knnLqYtEYCkb3UEOHSN3H8yzluB844byYOlXxf7rRWMWiSUizr3derLyHMOivXaZd7 lWi9v8lDpl3NIhXruBdntVm1C/sdU8skFLlP+viUN4BOu0pJltkPPHfYUb5QpbL+T2V5 fq6nEhsEp6cGAfaejkLfg7YDcQOph6PeEJsYIBM58HPkDzkaDAtrS3zQL2OMS2pk3NBD NaYRqrRFND3WNENBVN6Q105Om2sPso6C6SEK1ESn/AqSygTCwqWfkJP95SLLJptnHatp lyugFJRPNufljYOvL+JMkQprvpTD7eeE4/Qr8O7M+dKYwwNlfnEaI7fEM3pznocjg15H fiPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=31OXeIf+; 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 ie9-20020a17090b400900b002681dee79casi7611717pjb.108.2023.08.14.01.10.56; Mon, 14 Aug 2023 01:11:08 -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=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=31OXeIf+; 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 S233961AbjHNHZa (ORCPT + 99 others); Mon, 14 Aug 2023 03:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234093AbjHNHY5 (ORCPT ); Mon, 14 Aug 2023 03:24:57 -0400 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF41E77 for ; Mon, 14 Aug 2023 00:24:56 -0700 (PDT) Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-56d6dfa8b52so2830770eaf.3 for ; Mon, 14 Aug 2023 00:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1691997896; x=1692602696; 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=1NIpvt4nCqADNh0cqss2ffGGeYbGFw7fYt1kJmUbwbI=; b=31OXeIf+mXMuFZp/BWOkz0flJ8KejbkRr6wUM0EaIWFsfCQ2zCsPBGNavW2kDotoRb PsdgpoQL2gpaZ0ZXxpoLZllweTv3kJLm8VfWRPUbTrVZoBYG74ey9ou+i5DldGUtrvZj jJo8ZTlGZFQdNoXY5rUkd1Dtmfa47V/md6csocIKsbUStnghTAD3XIMWY0LbcOKZVL8R UKwErhue2XmH1yGzmSeWKwazVzfwuPeeEndpbu30PPUYDm1PkiRqb4L1jL+MuiOLySre zsaUYQ2DFJEH6D56bGkqsrwwi4rw9bkrOJfrBGOe8CCOsCJd8M3TTqTmLu7vsFb8lZhj caow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691997896; x=1692602696; 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=1NIpvt4nCqADNh0cqss2ffGGeYbGFw7fYt1kJmUbwbI=; b=UPa7F5mppFNRaZ3aQjj33Ow2U9fBaEP04aBT69ebeSQX/3VEszogpuwCqxWmwuNFGO J7yx4r97ImQiXHmHkOdnBBkl6VkEyJgj9UYJHiINwT/3+th6QneI/QwQOIse0CWzy58F Zllw0JkTz91c8IkL6Pry0XQw3zO36pFDDntuEvpInc0I4xygM/qlm/NzqrEhv5KOhsO6 Q/OydHEzJr/eswM9KqkkzUKDRE0ObxMi7/WeCLUVbzXZ9iNQF1ry+U74B2CWb0T372ly CvQXFB5Plps6zbLsqcI19XxDXKNT4iEJNvC/5JYxQWzHtEItxB8FaOVlLWMifNQNopM+ dfQA== X-Gm-Message-State: AOJu0YxmiX/P7inZc3MQMp/Jhal2Ai0F+xDpnD2sPCh2G+RC8k0+vW3L twEki881waneJueejNM6Q+ZujWHUHifVKKwArf//hQ== X-Received: by 2002:a05:6358:5906:b0:134:c37f:4b5c with SMTP id g6-20020a056358590600b00134c37f4b5cmr6968498rwf.22.1691997895708; Mon, 14 Aug 2023 00:24:55 -0700 (PDT) MIME-Version: 1.0 References: <20230612090713.652690195@infradead.org> <20230612093537.614161713@infradead.org> In-Reply-To: <20230612093537.614161713@infradead.org> From: Bartosz Golaszewski Date: Mon, 14 Aug 2023 09:24:44 +0200 Message-ID: Subject: Re: [PATCH v3 03/57] locking: Introduce __cleanup() based infrastructure To: Peter Zijlstra Cc: torvalds@linux-foundation.org, keescook@chromium.org, gregkh@linuxfoundation.org, pbonzini@redhat.com, masahiroy@kernel.org, nathan@kernel.org, ndesaulniers@google.com, nicolas@fjasle.eu, catalin.marinas@arm.com, will@kernel.org, vkoul@kernel.org, trix@redhat.com, ojeda@kernel.org, mingo@redhat.com, longman@redhat.com, boqun.feng@gmail.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, paulmck@kernel.org, frederic@kernel.org, quic_neeraju@quicinc.com, joel@joelfernandes.org, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, rientjes@google.com, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, john.johansen@canonical.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, llvm@lists.linux.dev, linux-perf-users@vger.kernel.org, rcu@vger.kernel.org, linux-security-module@vger.kernel.org, tglx@linutronix.de, ravi.bangoria@amd.com, error27@gmail.com, luc.vanoostenryck@gmail.com, Yury Norov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Mon, Jun 12, 2023 at 11:56=E2=80=AFAM Peter Zijlstra wrote: > [snip] > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > > /* > @@ -211,6 +212,8 @@ void kfree(const void *objp); > void kfree_sensitive(const void *objp); > size_t __ksize(const void *objp); > > +DEFINE_FREE(kfree, void *, if (_T) kfree(_T)) > + Peter, Yuri Norov pointed out to me (under a different cleanup patch) that kfree() handles NULL-pointers and there's no reason to check it again in DEFINE_FREE() macros. It seems right to me but I wanted to run it by you and check if there is maybe some reason I'm not seeing to doing it? Bartosz [snip]