linux/tools/perf/util/bpf_skel
Suchit Karunakaran 824b18f607 perf lock contention: Enable end-timestamp accounting for cgroup aggregation
update_lock_stat() handles lock contentions that start but never reach a
contention_end event (e.g., locks still held when profiling stops), but
previously treated LOCK_AGGR_CGROUP as a no-op due to missing cgroup
context in userspace.

Fix this by adding a cgroup_id field to struct tstamp_data, recording it
at contention_begin using get_current_cgroup_id() when aggr_mode is
LOCK_AGGR_CGROUP. Capturing it at contention_begin is semantically
correct, the contention cost is incurred by the task that had to wait,
not by whatever task happens to be running at contention_end. It is also
preferable from a performance standpoint, as contention_end runs just
before the task enters the critical section.

Update contention_end to use pelem->cgroup_id instead of calling
get_current_cgroup_id() dynamically, ensuring both complete and
incomplete contention events attribute the wait time to the cgroup at
wait-start time consistently.

Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tycho Andersen (AMD) <tycho@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-06-04 17:34:52 -03:00
..
vmlinux perf lock contention: Symbolize zone->lock using BTF 2025-04-29 12:23:53 -03:00
.gitignore perf build: Add ability to build with a generated vmlinux.h 2023-06-23 21:35:45 -07:00
augmented_raw_syscalls.bpf.c perf trace: Increase syscall handler map size to 1024 2025-10-31 12:29:44 -07:00
bperf_cgroup.bpf.c perf stat: Add/fix bperf cgroup max events workarounds 2025-10-25 16:44:21 -07:00
bperf_cgroup.h perf stat: Add/fix bperf cgroup max events workarounds 2025-10-25 16:44:21 -07:00
bperf_follower.bpf.c perf stat: Support inherit events during fork() for bperf 2024-11-01 23:31:08 -07:00
bperf_leader.bpf.c perf bpf_skel: Do not use typedef to avoid error on old clang 2021-12-06 21:57:53 -03:00
bperf_u.h perf stat: Support inherit events during fork() for bperf 2024-11-01 23:31:08 -07:00
bpf_prog_profiler.bpf.c perf bpf: Fix building perf with BUILD_BPF_SKEL=1 by default in more distros 2021-12-06 21:57:53 -03:00
func_latency.bpf.c perf ftrace latency: Add -e option to measure time between two events 2025-07-14 22:51:58 -07:00
kwork_top.bpf.c perf: Completely remove possibility to override MAX_NR_CPUS 2025-09-12 10:52:22 -03:00
kwork_trace.bpf.c perf kwork: Remove unreachable judgments 2025-03-18 16:55:30 -07:00
lock_contention.bpf.c perf lock contention: Enable end-timestamp accounting for cgroup aggregation 2026-06-04 17:34:52 -03:00
lock_data.h perf lock contention: Enable end-timestamp accounting for cgroup aggregation 2026-06-04 17:34:52 -03:00
off_cpu.bpf.c perf record --off-cpu: Add --off-cpu-thresh option 2025-05-05 21:51:54 -03:00
perf_version.h perf test: add test for BPF metadata collection 2025-06-20 14:55:24 -07:00
sample_filter.bpf.c perf bpf: Use __builtin_preserve_field_info for GCC compatibility 2025-10-02 14:57:07 -03:00
sample-filter.h perf bpf-filter: Support filtering on cgroups 2024-08-28 18:21:49 -03:00
syscall_summary.bpf.c perf trace: Handle task exit in BPF syscall summary 2026-02-26 10:49:00 -08:00
syscall_summary.h perf trace: Support --summary-mode=cgroup 2025-05-13 18:20:46 -03:00