Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp408704lqp; Sun, 9 Jun 2024 01:30:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYArlLhLL/ERKn7GhV2Xr4x37ic4sH0+Idf0Ef5jCsMHSgTH2Ty0dZszNceCJ6bQKyiqUIeyNAyKXYPMtt2LqdGI3k2hJ4ljK1fIf9EQ== X-Google-Smtp-Source: AGHT+IHDAPFAYBQ9bYlN278L4ksJ0/mKBzv9/4JvOYQk5bmENpYOvS6Nu+C6A+FgAiCxmoj7PRsa X-Received: by 2002:a50:a6d5:0:b0:57c:6248:9d2b with SMTP id 4fb4d7f45d1cf-57c62489da2mr2487095a12.29.1717921811080; Sun, 09 Jun 2024 01:30:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717921811; cv=pass; d=google.com; s=arc-20160816; b=UUVb0TfhZh65pMijBA3vjqEDqJYaNcezu4D8rAYAY35FRY8e4XrvDG29hb4v09E17F 3M9+Izi7ZdJomB/ZxghoE/86oq65Th1qVahWuAO+NuHlUjtacbhv3+aOZsQoWu6jNmPV V8v5KFFAK9srIpqS3vQe9ZrLo6wjAh9amehERHGGPtL7H13ECxV8WepyQbyaPNMsp/21 4jOLPOySLSszSKoQTdUv1alu+CCs/zqX6EQI1Cz/ppXUhevrb2jX96+P9MDBgvOmPyzj knDOEymLjl/+sKVhORLijiWBcokJ0pzAJrBf7OqGnrfhpz4XadsslgCfUcTf0Ir7dgj3 fILA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iFEsC8pdLHrqgm1R6uMYK9SmKFFJArc3WZMs1JbRrx4=; fh=v7AANL5I1Pi28qquHUtDxO2LQdA9Lq6NvFBICQ1iqIA=; b=Yq906SBz885s94eyHpQa332wON1Oog5xoy+H9ynLXZabGlunnZEuLNUJRJ66zX8ftn T5TDUvis2eDt6YaTCMLqosjLzcAsF/RwWQJqL3eFTk2pUJM9s0Snm+A6R6GAc214b+5l WF19YjLTKVFrWGnGD0Rg4bU1Q4W/V6fbqgr95ZlNhYuDRuOFBc3hDNW/Nr2ShAYE5jRv E8rnsLE0mvoPlckfwxryr4iahlZ6F9kuvazogj1HCr1GSRiJ9tmCW2xZ4S8mmujHPRJl bh+wpy17ZFMQeGDzO/2ovwZ47WdWUHH/+ldHOyJj1J+ASdyfbSdg+XtD3Qbkt0PiMeJY Lv7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b="VR9ZkR/t"; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-207284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae1fc6f4si3685645a12.239.2024.06.09.01.30.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 01:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b="VR9ZkR/t"; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-207284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr 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 C94BB1F21816 for ; Sun, 9 Jun 2024 08:30:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07007446D2; Sun, 9 Jun 2024 08:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="VR9ZkR/t" Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (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 02F412B9DE; Sun, 9 Jun 2024 08:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717921687; cv=none; b=kDuC3jgKXJcFIJRpncpCawW7JxgB+WL5bksZJUgNjzKe11dIx2xJZ+XKahPey36LC05tUzftBCxlkoDdrnC9drb28FVit/ksEh1fHoQmlLD8B2s6Uhgzcr6MqJNVyFHpQNCeF5EaNmqP11E1CFzisUHlp5UVLPXgn9bjx6lBQvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717921687; c=relaxed/simple; bh=qLLVPjhv4+wYws/zoYNgUIy1WO/VEbOv0vP9ijH0hiA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TQT1bz45xWV+s61mwNrOZi3F1GDIjSwgIlA+ovsXx4UUKkTZGRtgQVuyiatISXjHQq+Bd2S3QtMAiTlZgi8gfjSK2knoA2QOntww/DiR1FXrWk7wKS8Kc3N+RO8UTaowQYFLsXoAgRXnSnoX+J+pQuMk+dOAMzZo9pcTrKuXsYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=VR9ZkR/t; arc=none smtp.client-ip=192.134.164.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iFEsC8pdLHrqgm1R6uMYK9SmKFFJArc3WZMs1JbRrx4=; b=VR9ZkR/tb+iYAA9REZgVRsraxFHkhZ11fgfCacvLyn02NmHJfc87gyLD Ojt+FUosbkgoSE2C1JMAQN7vG2gd5dwBE+hs3r4NSMfW9A2ghm9xVo/Oy EOcbUxpNmR1GmMsTZzlJnUFmbdZ+8sCYfx7nFLbM81IfNLvBurUvDfYLL A=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.08,225,1712613600"; d="scan'208";a="169696899" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2024 10:27:48 +0200 From: Julia Lawall To: Steffen Klassert Cc: kernel-janitors@vger.kernel.org, Herbert Xu , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Vlastimil Babka Subject: [PATCH 04/14] xfrm6_tunnel: replace call_rcu by kfree_rcu for simple kmem_cache_free callback Date: Sun, 9 Jun 2024 10:27:16 +0200 Message-Id: <20240609082726.32742-5-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240609082726.32742-1-Julia.Lawall@inria.fr> References: <20240609082726.32742-1-Julia.Lawall@inria.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since SLOB was removed, it is not necessary to use call_rcu when the callback only performs kmem_cache_free. Use kfree_rcu() directly. The changes were done using the following Coccinelle semantic patch. This semantic patch is designed to ignore cases where the callback function is used in another way. // @r@ expression e; local idexpression e2; identifier cb,f; position p; @@ ( call_rcu(...,e2) | call_rcu(&e->f,cb@p) ) @r1@ type T; identifier x,r.cb; @@ cb(...) { ( kmem_cache_free(...); | T x = ...; kmem_cache_free(...,x); | T x; x = ...; kmem_cache_free(...,x); ) } @s depends on r1@ position p != r.p; identifier r.cb; @@ cb@p @script:ocaml@ cb << r.cb; p << s.p; @@ Printf.eprintf "Other use of %s at %s:%d\n" cb (List.hd p).file (List.hd p).line @depends on r1 && !s@ expression e; identifier r.cb,f; position r.p; @@ - call_rcu(&e->f,cb@p) + kfree_rcu(e,f) @r1a depends on !s@ type T; identifier x,r.cb; @@ - cb(...) { ( - kmem_cache_free(...); | - T x = ...; - kmem_cache_free(...,x); | - T x; - x = ...; - kmem_cache_free(...,x); ) - } // Signed-off-by: Julia Lawall Reviewed-by: Paul E. McKenney Reviewed-by: Vlastimil Babka --- net/ipv6/xfrm6_tunnel.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index bf140ef781c1..c3c893ddb6ee 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -178,12 +178,6 @@ __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr) } EXPORT_SYMBOL(xfrm6_tunnel_alloc_spi); -static void x6spi_destroy_rcu(struct rcu_head *head) -{ - kmem_cache_free(xfrm6_tunnel_spi_kmem, - container_of(head, struct xfrm6_tunnel_spi, rcu_head)); -} - static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr) { struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); @@ -200,7 +194,7 @@ static void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr) if (refcount_dec_and_test(&x6spi->refcnt)) { hlist_del_rcu(&x6spi->list_byaddr); hlist_del_rcu(&x6spi->list_byspi); - call_rcu(&x6spi->rcu_head, x6spi_destroy_rcu); + kfree_rcu(x6spi, rcu_head); break; } }