[Bug c++/66842] libatomic uses multiple locks for locked atomics

rth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 30 18:47:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66842

Richard Henderson <rth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu.org
           Severity|normal                      |enhancement

--- Comment #5 from Richard Henderson <rth at gcc dot gnu.org> ---
When libatomic was first written, it wasn't clear what the restrictions
from the various languages would be, nor even if that was the best of
ideas -- things that would Just Work lock-free would fail on other,
less popular platforms.

Thus libatomic is written such that accesses to the same object, via
different aliased pages, will work.  Thus locks are created on a per-
cacheline basis covering one page.

This does lead to inefficiencies wrt a more straight-forward solution,
but very careful thought needs to go into changing it.



More information about the Gcc-bugs mailing list