From: Mathieu Desnoyers Date: Sat, 16 Jul 2011 17:06:06 +0000 (-0400) Subject: Lib ring buffer: use TLS for nesting count X-Git-Tag: v1.9.1~326 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b9b858b8e2527bc30a7ed8a09b0962eb93e5c940;p=lttng-ust.git Lib ring buffer: use TLS for nesting count Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/frontend_api.h b/libringbuffer/frontend_api.h index 93b28e43..ebe5db49 100644 --- a/libringbuffer/frontend_api.h +++ b/libringbuffer/frontend_api.h @@ -40,12 +40,12 @@ int lib_ring_buffer_get_cpu(const struct lib_ring_buffer_config *config) rcu_read_lock_sched_notrace(); cpu = smp_processor_id(); - nesting = ++per_cpu(lib_ring_buffer_nesting, cpu); + nesting = ++lib_ring_buffer_nesting; /* TLS */ barrier(); if (unlikely(nesting > 4)) { WARN_ON_ONCE(1); - per_cpu(lib_ring_buffer_nesting, cpu)--; + lib_ring_buffer_nesting--; /* TLS */ rcu_read_unlock_sched_notrace(); return -EPERM; } else @@ -59,7 +59,7 @@ static inline void lib_ring_buffer_put_cpu(const struct lib_ring_buffer_config *config) { barrier(); - __get_cpu_var(lib_ring_buffer_nesting)--; + lib_ring_buffer_nesting--; /* TLS */ rcu_read_unlock_sched_notrace(); }