G1: Do not trigger marking cycle when old gen heap is a single region

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: None
    • Component/s: hotspot
    • gc

      In https://github.com/openjdk/jdk/pull/28738 (JDK-8373403), TestG1ClassUnloadingHWM.java shows that with -XX:G1HeapRegionSize=32m or larger region sizes, G1 could trigger unnecessary concurrent cycles in the testWithoutG1ClassUnloading() case.

      [~tschatzl] wrote: if there is only one region, there is no gain in collecting that region (unless, very unlikely, that single region is completely empty). Either the concurrent mark will select it as an evacuation candidate and copy its contents to another (single) region, or do nothing.

      [~iwalulya] proposed a potential fix:
      --- a/src/hotspot/share/gc/g1/g1IHOPControl.cpp
      +++ b/src/hotspot/share/gc/g1/g1IHOPControl.cpp
      @@ -115,7 +115,7 @@ size_t G1IHOPControl::get_conc_mark_start_threshold() {
         guarantee(_target_occupancy > 0, "Target occupancy must be initialized");
       
         if (!_is_adaptive || !have_enough_data_for_prediction()) {
      - return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
      + return MAX2((size_t)(_initial_ihop_percent * _target_occupancy / 100.0), G1HeapRegionSize);
         }

            Assignee:
            Unassigned
            Reporter:
            Man Cao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: