changeset 9732:bbd11e7bbe26

8138740: Start initial mark right after mixed GC if needed Summary: Instead of issuing a single young-only GC after the end of all mixed GCs, if needed immediately start an initial mark in that young-only GC. Reviewed-by: drwhite, mgerdin
author tschatzl
date Tue, 10 Nov 2015 11:07:15 +0100
parents 54e0d5521e14
children f17e5edbe761
files src/share/vm/gc/g1/g1CollectorPolicy.cpp src/share/vm/gc/g1/g1CollectorPolicy.hpp
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Tue Nov 10 11:07:15 2015 +0100
+++ b/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Tue Nov 10 11:07:15 2015 +0100
@@ -1003,11 +1003,8 @@
   last_pause_included_initial_mark = collector_state()->during_initial_mark_pause();
   if (last_pause_included_initial_mark) {
     record_concurrent_mark_init_end(0.0);
-  } else if (need_to_start_conc_mark("end of GC")) {
-    // Note: this might have already been set, if during the last
-    // pause we decided to start a cycle but at the beginning of
-    // this pause we decided to postpone it. That's OK.
-    collector_state()->set_initiate_conc_mark_if_possible(true);
+  } else {
+    maybe_start_marking();
   }
 
   _mmu_tracker->add_pause(end_time_sec - pause_time_ms/1000.0, end_time_sec);
@@ -1079,6 +1076,8 @@
     if (!next_gc_should_be_mixed("continue mixed GCs",
                                  "do not continue mixed GCs")) {
       collector_state()->set_gcs_are_young(true);
+
+      maybe_start_marking();
     }
   }
 
@@ -1932,6 +1931,15 @@
   return (double) reclaimable_bytes * 100.0 / (double) capacity_bytes;
 }
 
+void G1CollectorPolicy::maybe_start_marking() {
+  if (need_to_start_conc_mark("end of GC")) {
+    // Note: this might have already been set, if during the last
+    // pause we decided to start a cycle but at the beginning of
+    // this pause we decided to postpone it. That's OK.
+    collector_state()->set_initiate_conc_mark_if_possible(true);
+  }
+}
+
 bool G1CollectorPolicy::next_gc_should_be_mixed(const char* true_action_str,
                                                 const char* false_action_str) const {
   CollectionSetChooser* cset_chooser = _collectionSetChooser;
--- a/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Tue Nov 10 11:07:15 2015 +0100
+++ b/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Tue Nov 10 11:07:15 2015 +0100
@@ -534,6 +534,8 @@
   // as a percentage of the current heap capacity.
   double reclaimable_bytes_perc(size_t reclaimable_bytes) const;
 
+  // Sets up marking if proper conditions are met.
+  void maybe_start_marking();
 public:
 
   G1CollectorPolicy();