[PATCH] tracing: make ftrace_branch_data counters atomic

Khaled Saleh posted 1 patch 1 month, 1 week ago
include/linux/compiler.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] tracing: make ftrace_branch_data counters atomic
Posted by Khaled Saleh 1 month, 1 week ago
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 <khaled.saleh.req@gmail.com>
---
 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