[PATCH] tracing: make ftrace_branch_data counters atomic
Khaled Saleh <[email protected]> Tue, 5 May 2026 15:25:40 +0200
| Newsgroups | org.kernel.vger.linux-sparse,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Replace unsigned long counters with local_t and update all increments and reads to use local_inc() and local_read(). This fixes potential race conditions in branch statistics updates across CPUs. Signed-off-by: Khaled Saleh <[email protected]> --- include/linux/compiler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 1a506c54c060..39b89544adc7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -66,8 +66,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, .line = __LINE__, \ }; \ (cond) ? \ - (local_inc(&__if_trace.miss_hit[1]),1) :\ - (local_inc(&__if_trace.miss_hit[0]),0); \ + (local_inc(&__if_trace.miss_hit[1]), 1) :\ + (local_inc(&__if_trace.miss_hit[0]), 0); \ }) #endif /* CONFIG_PROFILE_ALL_BRANCHES */ -- 2.34.1