RFR: Mixed evacuation [v4]

Kelvin Nilsen kdnilsen at openjdk.java.net
Fri Apr 16 14:41:02 UTC 2021


On Thu, 15 Apr 2021 17:40:24 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> This code adds to generational Shenandoah the ability to perform concurrent garbage collection of young-gen and old-gen memory. Following completion of an old-gen concurrent marking effort, we select certain old-gen heap regions to serve as candidates for future collection sets. All dead objects within the old-gen heap regions that are not part of this candidate set are coalesced and filled so that remembered-set scanning of these old-gen heap regions will not be confused by "zombie objects" (objects that old-gen has decided are dead, which reside in regions that have not yet been collected). After concurrently coalescing and filling these dead objects, each subsequent young-gen evacuation pass includes a subset of the old-gen candidates until all candidates have been collected. This code passes TIER1 and hotspot-gc-shenandoah jtreg tests without regressions. A new jtreg test has been added to exercise concurrent old/young GC.
>
> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refactor choose_collection_set
>   
>   Divide the implementation of ShenandoahHeuristic::choose_colection_set() into
>   prepare_for_other_collection() and prime_collection_set_with_old_candiates() as
>   requested by reviewer of draft pull request.  The resulting code passes TIER1 and
>   hotspot_gc_shenandoah jtreg regressions and runs additional generational shenandoah
>   stress tests.

Was actually in the middle of doing something similar to this.  I can redirect towards your solution or continue with the one I am working on.   Here's how mine differs from yours:

1. I would introduce a subclass of ShenandoahHeuristics to be called ShenandoahOldHeuristics.  This would hold all the new methods that are specific to old-generation heuristics, currently added to ShenandoahHeuristics: prime_collection_set()  (renamed from prime_collection_set_with_old_candidates), prepare_for_old_collection(), start_old_evacuations(), unprocessed_old_collection_candidates(), next_old_collection_candidates(), consume_old_collection_candidate(), old_coalesce_and_fill_candidates(), get_coalesce_and_fill_candidates(), should_defer_gc()
2. I would pass a new ShenandoahOldHeuristics* old_heuristics argument to choose_collection_set() (possibly null in the case that we are doing GLOBAL - non-generation GC) and this argument would be passed down into prepare_for_other_collection().
3. I would hoist the check for should_defer_gc() into ShenandoahRegulatorThread::start_old_cycle() so that we don't have to "pollute" all the existing heuristics with this test.

As with your proposal, there would no longer be a _old_heuristics field within ShenandoahHeuristics.  This is why I have to pass in the new old_heuristics argument to the invocation of choose_collection_set().

Are you ok with this approach?

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

PR: https://git.openjdk.java.net/shenandoah/pull/29


More information about the shenandoah-dev mailing list