RFR: 8331714: Make OopMapCache installation lock-free

Coleen Phillimore coleenp at openjdk.org
Mon May 6 18:25:52 UTC 2024


On Mon, 6 May 2024 10:02:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Trying to solve [JDK-8331572](https://bugs.openjdk.org/browse/JDK-8331572) runs into all sorts of lock ranking issues with `OopMapCacheAlloc_lock`. I think it would be a bit saner to rewrite the double-checked locking installation to atomic lock-free. OpenJDK code was using this lock since the initial load.
> 
> There is a drawback that we might be trying to instantiate multiple `OopMapCache` instances from multiple threads. I think this is not a practical problem, as only a few threads would race here, and the allocation is relatively small (32*8 = 512 bytes). In imaginary worst^W nightmare case, with 100K threads racing we get a temporary native memory spike at +50M.
> 
> Additional testing:
>  - [ ] Linux x86_64 server fastdebug, `all` tests

This seems completely reasonable.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19100#pullrequestreview-2041405668


More information about the hotspot-dev mailing list