Skip to contentSkip to conversation

tracing: Use atomic64_inc_return() in trace_clock_counter()

PATCH New Uros Bizjak 1 participant 1 message Oct 7, 2024 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Use atomic64_inc_return() in trace_clock_counter()

Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref) to use optimized implementation and ease register pressure around the primitive for targets that implement optimized variant.

Cc Steven Rostedt <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
---
 kernel/trace/trace_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_clock.c +1 -1
index 4702efb00ff2..4cb2ebc439be 100644
@@ -154,5 +154,5 @@ static atomic64_t trace_counter;
  */
 u64 notrace trace_clock_counter(void)
 {
-	return atomic64_add_return(1, &trace_counter);
+	return atomic64_inc_return(&trace_counter);
 }
Signature · 1 line
2.46.2