perf ftrace: Use atomic inc to update histogram in BPF

It should use an atomic instruction to update even if the histogram is
keyed by delta as it's also used for stats.

Cc: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/r/20250227191223.1288473-3-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Namhyung Kim 2025-02-27 11:12:23 -08:00
parent 79056b3fe8
commit e1cde2d5e9

View File

@ -142,7 +142,7 @@ int BPF_PROG(func_end)
if (!hist)
return 0;
*hist += 1;
__sync_fetch_and_add(hist, 1);
__sync_fetch_and_add(&total, delta); // always in nsec
__sync_fetch_and_add(&count, 1);