summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2025-02-27 11:12:23 -0800
committerNamhyung Kim <namhyung@kernel.org>2025-03-13 00:18:10 -0700
commite1cde2d5e92f6728a022754650b9cb1e38358d50 (patch)
tree82d20a9ab544e34252064dd621af199fc2badc82 /tools
parent79056b3fe8878fa77ea8e9cbe062e428d2845982 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/bpf_skel/func_latency.bpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/bpf_skel/func_latency.bpf.c b/tools/perf/util/bpf_skel/func_latency.bpf.c
index ad7054744678..e731a79a753a 100644
--- a/tools/perf/util/bpf_skel/func_latency.bpf.c
+++ b/tools/perf/util/bpf_skel/func_latency.bpf.c
@@ -142,7 +142,7 @@ do_lookup:
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);