* [PATCH] perf stat: Do not open cgroups for BPF counters
@ 2026-07-08 20:04 Namhyung Kim
2026-07-16 16:58 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2026-07-08 20:04 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ian Rogers, Jiri Olsa, Adrian Hunter, James Clark,
Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users
The --bpf-counters and --for-each-cgroup options use a set of shared
events among the given cgroups rather than adding events for each cgroup
respectively. It only uses cgroup-ID to compare and calculate the
result. So no need to open and keep FDs for cgroups in BPF mode.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-stat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 92cdb2df7285befb..49e523058185b753 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2888,7 +2888,8 @@ int cmd_stat(int argc, const char **argv)
goto out;
}
- if (evlist__expand_cgroup(evsel_list, stat_config.cgroup_list, true) < 0) {
+ if (evlist__expand_cgroup(evsel_list, stat_config.cgroup_list,
+ !target.use_bpf) < 0) {
parse_options_usage(stat_usage, stat_options,
"for-each-cgroup", 0);
goto out;
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] perf stat: Do not open cgroups for BPF counters
2026-07-08 20:04 [PATCH] perf stat: Do not open cgroups for BPF counters Namhyung Kim
@ 2026-07-16 16:58 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2026-07-16 16:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim
Cc: Ian Rogers, Jiri Olsa, Adrian Hunter, James Clark,
Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users
On Wed, 08 Jul 2026 13:04:07 -0700, Namhyung Kim wrote:
> The --bpf-counters and --for-each-cgroup options use a set of shared
> events among the given cgroups rather than adding events for each cgroup
> respectively. It only uses cgroup-ID to compare and calculate the
> result. So no need to open and keep FDs for cgroups in BPF mode.
>
>
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-16 16:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-08 20:04 [PATCH] perf stat: Do not open cgroups for BPF counters Namhyung Kim
2026-07-16 16:58 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox