Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp78860rdb; Mon, 14 Aug 2023 10:00:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF31fURXlL2pxt425hH5dvf82hbOn1m/F+GlAj5ONnuZh7VKKo7LnFZ8+UZz/3vBX7CZ0Xp X-Received: by 2002:a17:906:5db4:b0:99c:ac84:663a with SMTP id n20-20020a1709065db400b0099cac84663amr7518235ejv.65.1692032449209; Mon, 14 Aug 2023 10:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692032449; cv=none; d=google.com; s=arc-20160816; b=IescGANKKBm/46F1oRQWmdsAIkU1ZoqALevpJ5ISyHfOXjBkesrvV24LQwByBeWOry gwnWBA3/0p3pTqZ3IzuDJfdEv3nk8wWf0/D9ECpVpPU7PCqabvl2YKI3pU6BUEPQ2CFX APZ0kL0/Cxc/EcmVmenRoR4NGqskd1nga6b9zA1X3D6kzAmIGBGs+6QqC7LxW1cj+rZU jGgiT623GKG8KnPkWM+PwSnZ7QzpIc5v6lFNApfCXV5frTR1emWPGskJnQXYght/c5sK P3F6xDZpMoRizScIHB2yPY7nDOzWN6yFacdJFlNulIwJlim1feUKPvsCG9o42f/4q0Za +m2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I37T2TkKnpeq90j00LfV02BTDwfjF9VFC100o2VAAoY=; fh=K9RkI8OIQSYHDGWCfZ7ilLJht6xhhe/SuUbDT3Mo9+0=; b=qh8dyzWfdL9lQl+tgphZD8T4TPRnpAdbGwVrGoEHY/rk0/iT7YuxnyFj/vXFsDjYte w3EUFjVSCEVg01Xd08+QsCdcb7Z9osKIMmcpQSWuikS+7j6bKz4bFknGX3C0XMYFDBZK WLUdfVrheIKjXURINq9bJP5nX5GXi0sRSi6TC6IEYuyEErmAvsLpLbpMzUCqRszgXOPn JMZq7hAUvzXutcz6qvdNHP9ItAcfY9ACzZ6WKvrWSqpla3fnR674Hzit3tqR9pJlIgmV wKgN1ImiU6Tnf1HTIyOqvfNCIo2zxZvZrXofHvaHFdke+pyA4pMdH2T5whf1O/fMP98Z 7aZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DXgM87KH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw24-20020a170906c79800b009937e7c4e50si7482379ejb.546.2023.08.14.09.59.59; Mon, 14 Aug 2023 10:00:49 -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=@linuxfoundation.org header.s=korg header.b=DXgM87KH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjHNPbn (ORCPT + 99 others); Mon, 14 Aug 2023 11:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232991AbjHNPbb (ORCPT ); Mon, 14 Aug 2023 11:31:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D5F130 for ; Mon, 14 Aug 2023 08:31:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C126617E6 for ; Mon, 14 Aug 2023 15:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9035AC433C8; Mon, 14 Aug 2023 15:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1692027089; bh=ip3+cm13zLW6dvsTq9Z9JEf7+UFKB7pZ0HPMZ31F96E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DXgM87KHqQVpjShJhCTHZ2huuxusSIMml7y57itXxPEtPIzylX8NPuCRgfqRrSnCL BYUaCoeK8oFQGwfa/L5pDfyuN7uxIWnObKdbNB882lLWJRjopmbyM0VeePVKbBRRtf 5Sof1EV65I4/2KuicNGp4um65pbY2D3rEQXiBQgo= Date: Mon, 14 Aug 2023 17:31:27 +0200 From: Greg Kroah-Hartman To: Dan Williams Cc: linux-coco@lists.linux.dev, Andrew Morton , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/5] mm/slab: Add __free() support for kvfree Message-ID: <2023081449-blurry-bath-248e@gregkh> References: <169199898909.1782217.10899362240465838600.stgit@dwillia2-xfh.jf.intel.com> <169199901230.1782217.9803098171993981037.stgit@dwillia2-xfh.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <169199901230.1782217.9803098171993981037.stgit@dwillia2-xfh.jf.intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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, Aug 14, 2023 at 12:43:32AM -0700, Dan Williams wrote: > Allow for the declaration of variables that trigger kvfree() when they > go out of scope. > > Cc: Andrew Morton > Cc: Peter Zijlstra > Cc: Greg Kroah-Hartman > Signed-off-by: Dan Williams > --- > include/linux/slab.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 848c7c82ad5a..241025367943 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -746,6 +746,8 @@ static inline __alloc_size(1, 2) void *kvcalloc(size_t n, size_t size, gfp_t fla > extern void *kvrealloc(const void *p, size_t oldsize, size_t newsize, gfp_t flags) > __realloc_size(3); > extern void kvfree(const void *addr); > +DEFINE_FREE(kvfree, void *, if (_T) kvfree(_T)) No need to check _T before calling this, right (as was also pointed out earlier). thanks, greg k-h