-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8351091: Shenandoah: global marking context completeness is not accurately maintained #23886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4830bc9
5414448
dabcf64
d159f6f
d3f4c91
6ded66a
e4f9d8f
01c6ea6
465deae
aa4a83f
c78f66e
2004973
d893918
952f7ea
17bcb35
c95c0f1
7c73e12
d4af962
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
pengxiaolong marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,7 +201,7 @@ class ShenandoahGeneration : public CHeapObj<mtGC>, public ShenandoahSpaceInfo { | |
| bool is_bitmap_clear(); | ||
|
|
||
| // We need to track the status of marking for different generations. | ||
| bool is_mark_complete(); | ||
| bool is_mark_complete() { return _is_marking_complete.is_set(); } | ||
| virtual void set_mark_complete(); | ||
| virtual void set_mark_incomplete(); | ||
|
Comment on lines
205
to
206
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these declared virtual?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I see that
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think we can do that if we deprecated the classical mode and only support generational Shenandoah, in classical mode, there is only global generation.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I follow. In the legacy (non-generational mode) we shouldn't care about the marking state of the old and young generations, just that of the GlobalGeneration. In the generational case, we explicitly track the marking state of the old and young generations explicitly. It sounds to me as if forcing the Old and Young marking states to the state of that of the GlobalGeneration must be exactly for the case where we are using Generational Shenandoah, and we are doing a Global collection? Indeed: I am saying that each of Old, Young, and Global generations maintain their own mark completion state and use that to determine what they pass back in response to So, you remove the part in the It is possible that I am still missing the actual structure here that requires the override for GlobalGeneration for the generational case.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I misunderstood your original proposal, I thought you meant to suggest to remove the flag from ShenandoahGlobalGeneration, instead the set_mark_complete/is_mark_complete will more like view/delegation layer like:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You proposal will make the impl of the set_mark_complete/is_mark_complete of ShenandoahGeneration cleaner, but the thing is it will change current design and behavior, we may have to update the code where there methods is called, e.g. when we call How about I follow up it in a separate task and update the implementation if necessary? I want to limit the changes involved in this PR, and only fix the bug.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The young and old generations are only instantiated in the generational mode, so using them without checking the mode will result in SEGV in non-generational modes. Global collections have a lot of overlap with old collections. I think what Ramki is saying, is that if we change all the code that makes assertions about the completion status of young/old marking to use the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Yes, that makes sense to me, thanks William. It would then be the case for the global generation that if is_mark_complete() then in the generational case that's also the case for both of its constituent generations. May be we can assert that when we fetch that at line 204 (and find it's true) for the case where we make the method May be I am being paranoid, but the assert would make me feel confident that the state maintenance isn't going awry/askew. |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,7 +169,8 @@ void ShenandoahGenerationalEvacuationTask::maybe_promote_region(ShenandoahHeapRe | |
| // We identify the entirety of the region as DIRTY to force the next remembered set scan to identify the "interesting pointers" | ||
| // contained herein. | ||
| void ShenandoahGenerationalEvacuationTask::promote_in_place(ShenandoahHeapRegion* region) { | ||
| ShenandoahMarkingContext* const marking_context = _heap->complete_marking_context(); | ||
| assert(!_heap->gc_generation()->is_old(), "Sanity check"); | ||
| ShenandoahMarkingContext* const marking_context = _heap->young_generation()->complete_marking_context(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clarity, you might assert the following before line 172: Even though it might seem somewhat tautological.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I'll add it.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Does Shenandoah promote region in global cycles? the gc_generation might be global if so.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I don't see any reason promotions should be verboten in global cycles. cc @earthling-amzn ? If that is indeed the case, a clean separation and maintenance of completeness of marking for global generation, and use of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the confirmation, I added assert as below since it gc_generation could be global :
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The assert may be fine, but the treatment of completeness of the marking context seems very brittle to me and apt to cause problems in the future. I would prefer a cleaner separation of these. May be we can sync up separately to discuss this along with @earthling-amzn .
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, regions may be promoted during a global cycle. Completing the mark for a global cycle also completes the mark for the young and old generations. |
||
| HeapWord* const tams = marking_context->top_at_mark_start(region); | ||
|
|
||
| { | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous suggestion/comments on What you have here sounds fine too, but a uniform usage of either keeping |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not this instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically there is only one global marking context for Shenandoah, even in generational mode, passing the region to marking_context doesn't make any difference.
But in the method
complete_marking_context(r), it checks if the affiliated generation has complete marking, it is a more convenient version ofcomplete_marking_context(affiliation).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, yes, that makes sense. Why not then use both
ShenandoahHeap::[complete_]marking_context()as synonyms forShehandoahHeap::active_generation()->[complete_]marking_context(). See other related comments in this review round.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel using
henandoahHeap::complete_marking_context()as synonyms forShehandoahHeap::active_generation()->[complete_]marking_context()may cause more confusion, just read from the name it seems that it indicates the marking is complete for the whole heap, not just the active generation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that makes sense.