RFR: 8308387: CLD created and unloading list sharing _next node pointer leads to concurrent YC missing CLD roots [v4]
David Holmes
dholmes at openjdk.org
Thu Jun 1 02:46:14 UTC 2023
On Wed, 31 May 2023 12:46:18 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> [JDK-8307106](https://bugs.openjdk.org/browse/JDK-8307106) introduced the ability to walk the created CLDs list in the CLDG without a lock. This was primarily introduced to allow lockless concurrent CLD roots scanning for young collections in generational ZGC. However because the CLD _next node pointer is shared between the two list this can lead to a concurrent iteration of the created CLDs missing list entries.
>>
>> This change introduces a second _unloading_next node pointer which is used for the unloading CLDs list. The set_next is now maintains the invariant that it only ever unlinks is_unloading() CLDs and maintains a consistent view of the tail list for anyone reading the list concurrently.
>>
>> Testing: tier1-3 and tier1-7 with Generational ZGC
>
> Axel Boldt-Christmas has updated the pull request incrementally with three additional commits since the last revision:
>
> - Spelling
> - Tidy up comment
> - Include unlink_next() in comment and remove whitespace
This logic is much clearer. Thanks for fixing the bug and cleaning it up.
Is the YC in the synopsis meant to be GC? If so please fix in JBS and the PR. Thanks
src/hotspot/share/classfile/classLoaderData.hpp line 171:
> 169: // After all dead CLDs have been moved to the unloading list, there's a
> 170: // synchronization point (handshake) to ensure that all threads reading these
> 171: // CLDs finish their work. This ensures that we don't have a user-after-free
use-after-free ?
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14241#pullrequestreview-1454449098
PR Comment: https://git.openjdk.org/jdk/pull/14241#issuecomment-1571237973
PR Review Comment: https://git.openjdk.org/jdk/pull/14241#discussion_r1212500351
More information about the hotspot-runtime-dev
mailing list