tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
44 stars 13 forks source link

fix(perf): use correct atomic memory operations #292

Closed cvonelm closed 1 year ago

cvonelm commented 1 year ago

Use atomic_load_n and atomic_store_n. those are equivalent to the the smp_load_acquire and smp_store_release functions used in ring_buffer.h in the linux kernel.

As a proof, they produce the exact same assembly on

x86: https://godbolt.org/z/s7cMoe5vK

and

ARM: https://godbolt.org/z/6oYrKnbzv

This fixes #287

cvonelm commented 1 year ago

The Actual implementation further down uses smp_load_acquire() and smp_store_release()