RFR: 8307106: Allow concurrent GCs to walk CLDG without ClassLoaderDataGraph_lock
David Holmes
dholmes at openjdk.org
Tue May 2 09:28:15 UTC 2023
On Fri, 28 Apr 2023 13:15:20 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
> A concurrent GC with concurrent class unloading can't currently walk the CLDG without the CLDG_lock today. We should add some synchronization code so it can do that safely. This patch adds the missing bits.
I don't see any change here where code stops acquiring the CLDG lock. Is this just a preparatory change?
Using acquire/release etc is certainly necessary to be able to walk the list safely, but it is not obvious it is sufficient. I can't tell when nodes in the CLDG actually get deleted such that the GC thread doing the walking can't access a no longer existing node.
Thanks.
src/hotspot/share/classfile/classLoaderDataGraph.cpp line 531:
> 529: assert(dead == _head, "sanity check");
> 530: // The GC might be walking this concurrently
> 531: Atomic::store(&_head, data);
If you are using `load_acquire` then surely this must be a `release-store` as they need to be paired.
-------------
PR Review: https://git.openjdk.org/jdk/pull/13718#pullrequestreview-1408725736
PR Review Comment: https://git.openjdk.org/jdk/pull/13718#discussion_r1182302186
More information about the hotspot-runtime-dev
mailing list