RFR: 8325574: Shenandoah: Simplify and enhance reporting of requested GCs

Aleksey Shipilev shade at openjdk.org
Mon Feb 12 10:36:04 UTC 2024


On Fri, 9 Feb 2024 19:43:33 GMT, William Kemper <wkemper at openjdk.org> wrote:

> Shenandoah distinguishes between 'implicit' and 'explicit' GC requests. The distinction is used to decide whether or not a request is serviced concurrently or with a full GC. The data collected is also included in the end-of-process report. This change simplifies handling of these requests and adds a tally of the underlying GC causes to the end-of-process report.

The simplification in `ShenandoahControlThread::run_service` looks very nice. I think we can make the code more straight-forward:

src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp line 98:

> 96: }
> 97: 
> 98: bool is_explicit_gc(GCCause::Cause cause) {

There is `ShenandoahControlThread::is_explicit_gc` too. I think we should have a shared definition for this somewhere. Maybe `ShenandoahControlThread` should delegate to `ShenandoahCollectorPolicy` then?

src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp line 138:

> 136:   out->cr();
> 137:   out->print_cr(SIZE_FORMAT_W(5) " Successful Concurrent GCs (%.2f%%)", _success_concurrent_gcs, percent_of(_success_concurrent_gcs, completed_gcs));
> 138:   if (ExplicitGCInvokesConcurrent) {

Instead of relying on flags here, should we explicitly (pun intended) record `_explicit_collection_causes` and `_implicit_collection_causes`?

src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp line 385:

> 383: bool ShenandoahControlThread::should_run_full_gc(GCCause::Cause cause) {
> 384:   return is_explicit_gc(cause) ? !ExplicitGCInvokesConcurrent : !ShenandoahImplicitGCInvokesConcurrent;
> 385: }

This sounds like a policy decision, which means a good fit for it is in `ShenandoahCollectorPolicy`?

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

PR Review: https://git.openjdk.org/jdk/pull/17795#pullrequestreview-1874932086
PR Review Comment: https://git.openjdk.org/jdk/pull/17795#discussion_r1485989218
PR Review Comment: https://git.openjdk.org/jdk/pull/17795#discussion_r1485991956
PR Review Comment: https://git.openjdk.org/jdk/pull/17795#discussion_r1485993917


More information about the hotspot-gc-dev mailing list