< prev index next >

src/hotspot/share/gc/g1/g1Policy.cpp

Print this page
rev 60584 : imported patch 8245511-ihop

@@ -55,11 +55,12 @@
 G1Policy::G1Policy(STWGCTimer* gc_timer) :
   _predictor(G1ConfidencePercent / 100.0),
   _analytics(new G1Analytics(&_predictor)),
   _remset_tracker(),
   _mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)),
-  _ihop_control(create_ihop_control(&_predictor)),
+  _old_gen_alloc_tracker(),
+  _ihop_control(create_ihop_control(&_old_gen_alloc_tracker, &_predictor)),
   _policy_counters(new GCPolicyCounters("GarbageFirst", 1, 2)),
   _full_collection_start_sec(0.0),
   _young_list_target_length(0),
   _young_list_fixed_length(0),
   _young_list_max_length(0),

@@ -70,11 +71,10 @@
   _young_gen_sizer(G1YoungGenSizer::create_gen_sizer()),
   _free_regions_at_end_of_collection(0),
   _rs_length(0),
   _rs_length_prediction(0),
   _pending_cards_at_gc_start(0),
-  _old_gen_alloc_tracker(),
   _concurrent_start_to_mixed(),
   _collection_set(NULL),
   _g1h(NULL),
   _phase_times_timer(gc_timer),
   _phase_times(NULL),

@@ -467,11 +467,11 @@
   _free_regions_at_end_of_collection = _g1h->num_free_regions();
   _survivor_surv_rate_group->reset();
   update_young_list_max_and_target_length();
   update_rs_length_prediction();
 
-  _old_gen_alloc_tracker.reset_after_full_gc();
+  _old_gen_alloc_tracker.reset_after_gc(_g1h->humongous_regions_count() * HeapRegion::GrainBytes);
 
   record_pause(FullGC, _full_collection_start_sec, end_sec);
 }
 
 static void log_refinement_stats(const char* kind, const G1ConcurrentRefineStats& stats) {

@@ -802,13 +802,12 @@
     // restrained by the heap reserve. Using the actual length would make the
     // prediction too small and the limit the young gen every time we get to the
     // predicted target occupancy.
     size_t last_unrestrained_young_length = update_young_list_max_and_target_length();
 
-    _old_gen_alloc_tracker.reset_after_young_gc(app_time_ms / 1000.0);
-    update_ihop_prediction(_old_gen_alloc_tracker.last_cycle_duration(),
-                           _old_gen_alloc_tracker.last_cycle_old_bytes(),
+    _old_gen_alloc_tracker.reset_after_gc(_g1h->humongous_regions_count() * HeapRegion::GrainBytes);
+    update_ihop_prediction(app_time_ms / 1000.0,
                            last_unrestrained_young_length * HeapRegion::GrainBytes,
                            is_young_only_pause(this_pause));
 
     _ihop_control->send_trace_event(_g1h->gc_tracer_stw());
   } else {

@@ -842,23 +841,24 @@
   _g1h->concurrent_refine()->adjust(logged_cards_time,
                                     phase_times()->sum_thread_work_items(G1GCPhaseTimes::MergeLB, G1GCPhaseTimes::MergeLBDirtyCards),
                                     scan_logged_cards_time_goal_ms);
 }
 
-G1IHOPControl* G1Policy::create_ihop_control(const G1Predictions* predictor){
+G1IHOPControl* G1Policy::create_ihop_control(const G1OldGenAllocationTracker* old_gen_alloc_tracker,
+                                             const G1Predictions* predictor) {
   if (G1UseAdaptiveIHOP) {
     return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
+                                     old_gen_alloc_tracker,
                                      predictor,
                                      G1ReservePercent,
                                      G1HeapWastePercent);
   } else {
-    return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
+    return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent, old_gen_alloc_tracker);
   }
 }
 
 void G1Policy::update_ihop_prediction(double mutator_time_s,
-                                      size_t mutator_alloc_bytes,
                                       size_t young_gen_size,
                                       bool this_gc_was_young_only) {
   // Always try to update IHOP prediction. Even evacuation failures give information
   // about e.g. whether to start IHOP earlier next time.
 

@@ -883,11 +883,11 @@
   // As an approximation for the young gc promotion rates during marking we use
   // all of them. In many applications there are only a few if any young gcs during
   // marking, which makes any prediction useless. This increases the accuracy of the
   // prediction.
   if (this_gc_was_young_only && mutator_time_s > min_valid_time) {
-    _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size);
+    _ihop_control->update_allocation_info(mutator_time_s, young_gen_size);
     report = true;
   }
 
   if (report) {
     report_ihop_statistics();
< prev index next >