Re: [PATCH v3 1/3] perf lock contention: Clear lock addr after use

From: Namhyung Kim
Date: Thu Oct 26 2023 - 13:11:41 EST


On Fri, 20 Oct 2023 13:47:39 -0700, Namhyung Kim wrote:
> It checks the current lock to calculated the delta of contention time.
> The address is saved in the tstamp map which is allocated at begining of
> contention and released at end of contention.
>
> But it's possible for bpf_map_delete_elem() to fail. In that case, the
> element in the tstamp map kept for the current lock and it makes the
> next contention for the same lock tracked incorrectly. Specificially
> the next contention begin will see the existing element for the task and
> it'd just return. Then the next contention end will see the element and
> calculate the time using the timestamp for the previous begin.
>
> [...]

Applied to perf-tools-next, thanks!