diff options
author | Chun-Tse Shao <ctshao@google.com> | 2025-02-26 16:28:54 -0800 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2025-02-28 00:29:37 -0800 |
commit | 425bc88352150506075a3aca80750419b5eac4a5 (patch) | |
tree | 2e3f7e010c8df25833f164055984a360efd715a1 /tools/perf/util/trace-event-scripting.c | |
parent | 17ae7f904977f3d097004f91158abcc10e0df484 (diff) |
perf lock: Retrieve owner callstack in bpf program
This implements per-callstack aggregation of lock owners in addition to
per-thread. The owner callstack is captured using `bpf_get_task_stack()`
at `contention_begin()` and it also adds a custom stackid function for the
owner stacks to be compared easily.
The owner info is kept in a hash map using lock addr as a key to handle
multiple waiters for the same lock. At `contention_end()`, it updates the
owner lock stat based on the info that was saved at `contention_begin()`.
If there are more waiters, it'd update the owner pid to itself as
`contention_end()` means it gets the lock now. But it also needs to check
the return value of the lock function in case task was killed by a signal
or something.
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
Tested-by: Athira Rajeev <atrajeev@linux.ibm.com>
Link: https://lore.kernel.org/r/20250227003359.732948-3-ctshao@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions