RFR: 8329088: Stack chunk thawing races with concurrent GC stack iteration [v2]

Erik Österlund eosterlund at openjdk.org
Thu Apr 11 13:27:42 UTC 2024


On Mon, 8 Apr 2024 14:59:47 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.

I thought about going in that direction as well. But in the end, I found it to be more direct and easy to understand if the property being tracked directly in the stack chunk is bottom, and argsize is the computed property, as opposed to the other way around.

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

PR Comment: https://git.openjdk.org/jdk/pull/18643#issuecomment-2049689256


More information about the hotspot-dev mailing list