perf tools: Ignore deleted cgroups
authorNamhyung Kim <namhyung@kernel.org>
Thu, 9 May 2024 18:22:35 +0000 (11:22 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 May 2024 13:52:46 +0000 (10:52 -0300)
commite2eeef290c4adad7a0f95c4a41e1a992326a7829
treeff4e6cd1721ee4d10b8c149c6721f1e66d4898f5
parent5ceb57990bf41684e9bc186128a07025adb896bd
perf tools: Ignore deleted cgroups

On large systems, cgroups can be created and deleted often.  That means
there's a race between perf tools and cgroups when it gets the cgroup
name and opens the cgroup.

I got a report that 'perf stat' with many cgroups failed quite often due
to the missing cgroups on such a large machine.

I think we can ignore such cgroups when expanding events and use id 0 if
it fails to read the cgroup id.  IIUC 0 is not a vaild cgroup id so it
won't update event counts for the failed cgroups.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240509182235.2319599-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf_counter_cgroup.c
tools/perf/util/cgroup.c