From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388629; b=NAhp6XvMONJ1cNI/Q69K1t9FILDLR0faSU3kF6VLdokyaLT21RAQ1wgXp56vZFug+9Qn xCTrAecS/di9erZ2Ev4f9fS8ScB40czqZPPLW3U50MScsRyW0QQVrUIRyX7JcKOgZLMxa ZIICgIq3ZbRekK/RY+3osNPV4TCIMYab5CCvXKJY3sk+PuqwTZXrmE7A6zB741e2+W9yC 1D5i8TsgG1APXT38SzC5AyTfboC6ClLMH/HO2VFmiU8s7+x/dbjuXjsbt0dLTBgcl9k06 qq5jvxsq2FTjsRb6WDZq4XZr6fCmDEUA0mGvgta87AbpBsI4mYRvSjQYaV3yxlCygiA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388629; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=VVgbvvM2qWFGVkxmBpsp9AE6laQFF9T4YGryG8Cjkp8=; b=bcCHpXLGMTCbXGiH84A5Y50YqpAFTQxSHJFxSdKHd+jsvFWkqjKUqKdQtHraI/DGx28v QZPFzw4DQRb0lsc0eJNSUf04ihq6aNBinoukpp1auGXinNMPQkYLYqIN1CYvkJUMFm/Ru PnV3gCXB7K0Zhvc3a4tB3jMAl9ysQtAzuUzthzbsYS6HfCsWR6pnuNAj2BS1J8xOPr8Lo 3JGg1uJPR4/VawRa126uc39XtphaHeBWL7/hJGICJEw8EVUkbvhw0DPzRZwW7IEKyE6cw ur5HIQS/roQ7DTD7+2Ved6KC8WHEjuLBtUFdR1xU/qmVkY4OjhPlsvyFBA+znUzZM7w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hBpPc7Ej; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E5E4606A339; Fri, 4 Dec 2026 12:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=hBpPc7Ej Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C2851F000C2; Fri, 4 Dec 2026 12:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388629; bh=VVgbvvM2qWFGVkxmBpsp9AE6laQFF9T4YGryG8Cjkp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hBpPc7Ejkjzc7RB1s745Nhz1cpcFIAiKG600VcO+gfNHlYdGYaNNfdn3ljOoWK5x1 sMFfLWuvOVsBMnyOLnkKLrBiQAmxnfk9cpjAoUaWoDMvr1gM4Cb5wijr5XFvbQWNsh +BfFp08IJCJYWXDnWorAdMt4ptsOdE3hLYnWUmWY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chuang Wang , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 6.1 0694/1059] tracing/eprobe: Iterate trace_eprobe directly Date: Fri, 4 Dec 2026 19:03:45 +0900 Message-ID: <20261204100701.962022290@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chuang Wang [ Upstream commit f8bbf8b9901a09915d7b466ceb2bccc1fb5abea8 ] Refer to the description in [1], we can skip "container_of()" following "list_for_each_entry()" by using "list_for_each_entry()" with "struct trace_eprobe" and "tp.list". Also, this patch defines "for_each_trace_eprobe_tp" to simplify the code of the same logic. [1] https://lore.kernel.org/all/CAHk-=wjakjw6-rDzDDBsuMoDCqd+9ogifR_EE1F0K-jYek1CdA@mail.gmail.com/ Link: https://lore.kernel.org/all/20230822022433.262478-1-nashuiliang@gmail.com/ Signed-off-by: Chuang Wang Acked-by: Masami Hiramatsu (Google) Signed-off-by: Masami Hiramatsu (Google) Stable-dep-of: be94710b1f6b ("tracing/eprobe: Install the trigger for every instance that enables the eprobe") Signed-off-by: Sasha Levin --- kernel/trace/trace_eprobe.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 19116ed205da0..8d9cd7617fc75 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -41,6 +41,10 @@ struct eprobe_data { struct trace_eprobe *ep; }; + +#define for_each_trace_eprobe_tp(ep, _tp) \ + list_for_each_entry(ep, trace_probe_probe_list(_tp), tp.list) + static int __trace_eprobe_create(int argc, const char *argv[]); static void trace_event_probe_cleanup(struct trace_eprobe *ep) @@ -740,7 +744,7 @@ static int disable_eprobe(struct trace_eprobe *ep, static int enable_trace_eprobe(struct trace_event_call *call, struct trace_event_file *file) { - struct trace_probe *pos, *tp; + struct trace_probe *tp; struct trace_eprobe *ep; bool enabled; int ret = 0; @@ -762,8 +766,7 @@ static int enable_trace_eprobe(struct trace_event_call *call, if (enabled) return 0; - list_for_each_entry(pos, trace_probe_probe_list(tp), list) { - ep = container_of(pos, struct trace_eprobe, tp); + for_each_trace_eprobe_tp(ep, tp) { ret = enable_eprobe(ep, file); if (ret) break; @@ -780,8 +783,7 @@ static int enable_trace_eprobe(struct trace_event_call *call, */ WARN_ON_ONCE(ret != -ENOMEM); - list_for_each_entry(pos, trace_probe_probe_list(tp), list) { - ep = container_of(pos, struct trace_eprobe, tp); + for_each_trace_eprobe_tp(ep, tp) { disable_eprobe(ep, file->tr); if (!--cnt) break; @@ -799,7 +801,7 @@ static int enable_trace_eprobe(struct trace_event_call *call, static int disable_trace_eprobe(struct trace_event_call *call, struct trace_event_file *file) { - struct trace_probe *pos, *tp; + struct trace_probe *tp; struct trace_eprobe *ep; tp = trace_probe_primary_from_call(call); @@ -816,10 +818,8 @@ static int disable_trace_eprobe(struct trace_event_call *call, trace_probe_clear_flag(tp, TP_FLAG_PROFILE); if (!trace_probe_is_enabled(tp)) { - list_for_each_entry(pos, trace_probe_probe_list(tp), list) { - ep = container_of(pos, struct trace_eprobe, tp); + for_each_trace_eprobe_tp(ep, tp) disable_eprobe(ep, file->tr); - } } out: -- 2.53.0