Message ID | 20250227191223.1288473-3-namhyung@kernel.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [1/3] perf ftrace: Fix latency stats with BPF | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/tools/perf/util/bpf_skel/func_latency.bpf.c b/tools/perf/util/bpf_skel/func_latency.bpf.c index ad70547446786c54..e731a79a753a4d2d 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 @@ 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);
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> Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/util/bpf_skel/func_latency.bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)