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

David Holmes dholmes at openjdk.org
Wed Jul 3 06:54:24 UTC 2024


On Wed, 3 Jul 2024 06:46:37 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert destructor change
>
> src/hotspot/share/classfile/classLoaderData.cpp line 207:
> 
>> 205:   Chunk* chunk = Atomic::load_acquire(&_head);
>> 206:   while (chunk != nullptr) {
>> 207:     count += Atomic::load(&chunk->_size);
> 
> I don't think this is necessary - there is no concurrent write of this chunk's size possible whilst we read it.

Apologies, yes there is. We publish `_head` and then update its `_size` after the fact. That has a bad smell about it IMO.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19919#discussion_r1663609554


More information about the hotspot-runtime-dev mailing list