Re: [PATCH] perf lock contention: Fix spinlock and rwlock accounting

From: Arnaldo Carvalho de Melo
Date: Fri Aug 30 2024 - 09:24:04 EST


On Tue, Aug 27, 2024 at 10:29:53PM -0700, Namhyung Kim wrote:
> The spinlock and rwlock use a single-element per-cpu array to track
> current locks due to performance reason. But this means the key is
> always available and it cannot simply account lock stats in the array
> because some of them are invalid.
>
> In fact, the contention_end() program in the BPF invalidates the entry
> by setting the 'lock' value to 0 instead of deleting the entry for the
> hashmap. So it should skip entries with the lock value of 0 in the
> account_end_timestamp().

Thanks, applied to perf-tools-next,

- Arnaldo