From nobody Thu Dec 18 23:15:17 2025 Received: from baidu.com (mx24.baidu.com [111.206.215.185]) (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 288B71DED5B; Sun, 5 Oct 2025 12:27:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.206.215.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759667249; cv=none; b=QwuW5LDCkugvxvBHl3Mg2bMt9Do6Kbt9/sln6zKuZ5i3aTXJTQzqMnyaDSesxtqkQSM772/lz5Kp3p6hZK9A0DK1AIM+sMxK0bCWzyzuTKt/sPPvMP+jd7Y4Nh9cBzMLp+wHJCjd6LB/DdhCe82dWx770AL0wL10Tti8WfAasow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759667249; c=relaxed/simple; bh=8NEuS4IryImOLuWbk47FRs5S5vyICdNE+kwwGvuwb9c=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=AvRmbGecLVwzJmLr7xnxiroPUgO6P2TA5S3Xasahasz9ORFzB7uOOneR0cx1NCzD9fw4tv12tQPJLeqPecPR5KTrMsI+6Rdk3rOWO6apcXxq4Drr3rHh/mGizrN/GCGXTuzzYipK7OpRPgHryuf3nExPTrhJfGXZ7e7DdikUjm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; arc=none smtp.client-ip=111.206.215.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com From: Fushuai Wang To: , , , , , CC: , , , Fushuai Wang Subject: [PATCH] wireguard: allowedips: Use kfree_rcu() instead of call_rcu() Date: Sun, 5 Oct 2025 20:26:26 +0800 Message-ID: <20251005122626.26988-1-wangfushuai@baidu.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: bjkjy-exc2.internal.baidu.com (172.31.50.46) To bjkjy-exc17.internal.baidu.com (172.31.50.13) X-FEAS-Client-IP: 172.31.50.13 X-FE-Policy-ID: 52:10:53:SYSTEM Content-Type: text/plain; charset="utf-8" Replace call_rcu() + kmem_cache_free() with kfree_rcu() to simplify the code and reduce function size. Signed-off-by: Fushuai Wang --- drivers/net/wireguard/allowedips.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/all= owedips.c index 09f7fcd7da78..506f7cf0d7cf 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -48,11 +48,6 @@ static void push_rcu(struct allowedips_node **stack, } } =20 -static void node_free_rcu(struct rcu_head *rcu) -{ - kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu= )); -} - static void root_free_rcu(struct rcu_head *rcu) { struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_DEPTH] =3D { @@ -271,13 +266,13 @@ static void remove_node(struct allowedips_node *node,= struct mutex *lock) if (free_parent) child =3D rcu_dereference_protected(parent->bit[!(node->parent_bit_packe= d & 1)], lockdep_is_held(lock)); - call_rcu(&node->rcu, node_free_rcu); + kfree_rcu(&node, rcu); if (!free_parent) return; if (child) child->parent_bit_packed =3D parent->parent_bit_packed; *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) =3D child; - call_rcu(&parent->rcu, node_free_rcu); + kfree_rcu(&parent, rcu); } =20 static int remove(struct allowedips_node __rcu **trie, u8 bits, const u8 *= key, --=20 2.36.1