RFR: 8329088: Stack chunk thawing races with concurrent GC stack iteration [v2]
Erik Österlund
eosterlund at openjdk.org
Mon Apr 22 09:42:42 UTC 2024
On Mon, 8 Apr 2024 15:01:01 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
>>> In the new model, is_empty() is true iff sp and bottom are exactly the same. Bottom is only set during freezing, never during thawing. The bottom is initialized whenever the bottom frame is frozen, and left untouched during thawing. Unlike thawing, the freeze operation does not race with the GC by design. Hence we have moved one of the racy mutations to the operation that doesn't race with the GC. The GC is now only exposed to changing sp(). It doesn't matter if it observes the old or new sp(), now that we have removed the only source if inconsistency describing said frame (racing argsize).
>>>
>> So if the race happens only when resetting the stackChunk values when thawing the last frame, wouldn't it be enough to avoid clearing the argsize there? Because if we read the new sp when creating the stack frame iterator, regardless of the argsize value read, is_done() will be true so we won't iterate any frame. I'm trying to understand if the new model is needed to fix the race or that is part of a cleanup/refactoring.
>
>> Unlike thawing, the freeze operation does not race with the GC by design.
>>
> Is this with the changes in the allocation code in this patch or even before those there was no race?
Thanks for the detailed review @pchilano! I made the suggested updates.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18643#issuecomment-2068944427
More information about the hotspot-dev
mailing list