RFR: 8335217: Fix memory ordering in ClassLoaderData::ChunkedHandleList [v2]

Zhengyu Gu zgu at openjdk.org
Thu Jun 27 13:29:38 UTC 2024


On Thu, 27 Jun 2024 09:30:53 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> Did you see that ChunkedHandleList::_size is also updated concurrently? If there's truly a concurrency order that this fixes, then maybe we should at least use Atomic::load when we're reading the _size?

You mean `ChunkedHandleList::Chunk::_size`, right?

It is updated via `Atomic::release_store()` [here](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/classLoaderData.cpp#L199) and read via `Atomic::load_acquire()` [here](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/classLoaderData.cpp#L223).

And now, I believe it also needs `Atomic::load_acquire()` for [this read](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/classfile/classLoaderData.cpp#L225) as well and I agree that should use `Atomic::load()` to make it more explicit.

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

PR Comment: https://git.openjdk.org/jdk/pull/19919#issuecomment-2194691508


More information about the hotspot-runtime-dev mailing list