Sujet : Re: arm ldxr/stxr vs cas
De : terje.mathisen (at) *nospam* tmsw.no (Terje Mathisen)
Groupes : comp.archDate : 09. Sep 2024, 08:14:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbm790$2atfb$2@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2
jseigh wrote:
I'm not so sure about making the memory lock granularity same as
cache line size but that's an implementation decision I guess.
Just make sure you never have multiple locks residing inside the same cache line!
I do like the idea of detecting potential contention at the
start of LL/SC so you can do back off. Right now the only way I
can detect contention is after the fact when the CAS fails and
I probably have the cache line exclusive at that point. It's
pretty problematic.
I do prefer LOCK XADD instead of CAS (CmpXchg*), because the return value will also tell you which queue entry to pick/work on.
It will not be optimal when really contended, but at least one participant will make forward progress, and typically several of them.
Terje
-- - <Terje.Mathisen at tmsw.no>"almost all programming can be viewed as an exercise in caching"