]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf record --off-cpu: Disable perf_event's callchain collection
authorHoward Chu <howardchu95@gmail.com>
Thu, 1 May 2025 02:28:04 +0000 (19:28 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 6 May 2025 00:51:12 +0000 (21:51 -0300)
There is a check in evsel.c that does this:

if (evsel__is_offcpu_event(evsel))
evsel->core.attr.sample_type &= OFFCPU_SAMPLE_TYPES;

This along with:

 #define OFFCPU_SAMPLE_TYPES  (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | \
      PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
      PERF_SAMPLE_ID | PERF_SAMPLE_CPU | \
      PERF_SAMPLE_PERIOD | PERF_SAMPLE_CALLCHAIN | \
      PERF_SAMPLE_CGROUP)

will tell perf_event to collect callchain.

We don't need the callchain from perf_event when collecting off-cpu
samples, because it's prev's callchain, not next's callchain.

   (perf_event)     (task_storage) (needed)
   prev             next
   |                  |
   ---sched_switch---->

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Howard Chu <howardchu95@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Tested-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241108204137.2444151-8-howardchu95@gmail.com
Link: https://lore.kernel.org/r/20250501022809.449767-7-howardchu95@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/off_cpu.h

index 2dd67c60f21196ff286730ee8659f8a0c09e6aac..2a4b7f9b2c4cbd7c224f9a5cee2cafb6ae8fae90 100644 (file)
@@ -13,7 +13,7 @@ struct record_opts;
 #define OFFCPU_SAMPLE_TYPES  (PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_IP | \
                              PERF_SAMPLE_TID | PERF_SAMPLE_TIME | \
                              PERF_SAMPLE_ID | PERF_SAMPLE_CPU | \
-                             PERF_SAMPLE_PERIOD | PERF_SAMPLE_CALLCHAIN | \
+                             PERF_SAMPLE_PERIOD | PERF_SAMPLE_RAW | \
                              PERF_SAMPLE_CGROUP)