RFR: 8316955: Unnecessary memory barrier for reading OopMapCacheEntry from OopMapCache

Zhengyu Gu zgu at openjdk.org
Thu Sep 28 12:13:22 UTC 2023


On Thu, 28 Sep 2023 04:10:27 GMT, David Holmes <dholmes at openjdk.org> wrote:

> The general pattern we use for lock-free reads is to use load_acquire to match the (implicit) release_store done by the writer - even if the write is actually done by a CAS. IIRC not all platforms use the same strength of barrier for CAS even when in the default conservative mode, so I cannot say for sure that the acquire on the reader side is unnecessary. Conversely if it is necessary then removing it would likely lead to some very obscure bugs. Unless this is causing a significant performance issue I would not contemplate changing it without a detailed analysis of each platform's CAS code.

Thanks for the comments. NMT (mallocSiteTable) has been using barrier free on read since day one of NMT2, any concerns here?

I will try to get some performance number, see how much impact of this barrier.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15944#issuecomment-1739021036


More information about the hotspot-gc-dev mailing list