Reason I am asking this, it will make the fix independent of the architecture of cache lines, size of cache lines.
Also, the compiler directive/annotation would help developer to use it more liberally when they think, false sharing can happen.
Reason I am asking this, it will make the fix independent of the architecture of cache lines, size of cache lines.
Also, the compiler directive/annotation would help developer to use it more liberally when they think, false sharing can happen.
I’m not sure whether a single target architecture can (either in theory or in practice) map to hardware with different line sizes. If so, another problem is that the compiler’s idea of the cache line size might not match the hardware’s.
[1]: https://www.mono-project.com/news/2016/09/12/arm64-icache/
Can we write like this? Klass ssc __attribute__((64));
This could convey more info than padding.
Further, I wish, gcc could have provided an attribute that explicitly forces for the cache line alignment than just generic alignment. Generic scalar type alignment is not same as the cache line alignment.
Example: Klass sc __attribute__((start_at_cache_line));