RFR: 8341544: Restore fence() in Mutex

David Holmes dholmes at openjdk.org
Thu May 15 11:47:30 UTC 2025


On Mon, 5 May 2025 11:13:05 GMT, Anton Artemov <duke at openjdk.org> wrote:

> Added a fence in the mutex code in order to make the critical section provided by the mutex follow the roach-motel semantics. 
> 
> No significant performance impact observed in an extending testing.
> 
> Tested in tiers 1-3.

As per JBS comment I still think we only need to add the missing storeload part of the full-fence, to complement the existing barriers the platform sync primitives provide.

src/hotspot/share/runtime/mutex.hpp line 218:

> 216:   //  section provided by the mutex follow the Roach-Motel semantics. Having a fence does
> 217:   //  not have any significant impact on peformance, as this is an internal VM
> 218:   //  mutex and is generally not in hot code parts.

Suggestion:

  //  mutex and is generally not in hot code paths.

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

PR Comment: https://git.openjdk.org/jdk/pull/25033#issuecomment-2875914339
PR Review Comment: https://git.openjdk.org/jdk/pull/25033#discussion_r2080488521


More information about the hotspot-runtime-dev mailing list