comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 4912:a9647476d1a4

7132029: G1: mixed GC phase lasts for longer than it should Summary: Revamp of the mechanism that chooses old regions for inclusion in the CSet. It simplifies the code and introduces min and max bounds on the number of old regions added to the CSet at each mixed GC to avoid pathological cases. It also ensures that when we do a mixed GC we'll always find old regions to add to the CSet (i.e., it eliminates the case where a mixed GC will collect no old regions which can happen today). Reviewed-by: johnc, brutisso
author tonyp
date Wed, 15 Feb 2012 13:06:53 -0500
parents eff609af17d7
children 9a9bb0010c91
comparison
equal deleted inserted replaced
4911:d903bf750e9f 4912:a9647476d1a4
310 310
311 double _recorded_young_free_cset_time_ms; 311 double _recorded_young_free_cset_time_ms;
312 double _recorded_non_young_free_cset_time_ms; 312 double _recorded_non_young_free_cset_time_ms;
313 313
314 double _sigma; 314 double _sigma;
315 double _expensive_region_limit_ms;
316 315
317 size_t _rs_lengths_prediction; 316 size_t _rs_lengths_prediction;
318 317
319 size_t _known_garbage_bytes; 318 size_t _known_garbage_bytes;
320 double _known_garbage_ratio; 319 double _known_garbage_ratio;
321 320
322 double sigma() { 321 double sigma() { return _sigma; }
323 return _sigma;
324 }
325 322
326 // A function that prevents us putting too much stock in small sample 323 // A function that prevents us putting too much stock in small sample
327 // sets. Returns a number between 2.0 and 1.0, depending on the number 324 // sets. Returns a number between 2.0 and 1.0, depending on the number
328 // of samples. 5 or more samples yields one; fewer scales linearly from 325 // of samples. 5 or more samples yields one; fewer scales linearly from
329 // 2.0 at 1 sample to 1.0 at 5. 326 // 2.0 at 1 sample to 1.0 at 5.
488 485
489 double predict_non_young_other_time_ms(size_t non_young_num) { 486 double predict_non_young_other_time_ms(size_t non_young_num) {
490 return (double) non_young_num * 487 return (double) non_young_num *
491 get_new_prediction(_non_young_other_cost_per_region_ms_seq); 488 get_new_prediction(_non_young_other_cost_per_region_ms_seq);
492 } 489 }
493
494 void check_if_region_is_too_expensive(double predicted_time_ms);
495 490
496 double predict_young_collection_elapsed_time_ms(size_t adjustment); 491 double predict_young_collection_elapsed_time_ms(size_t adjustment);
497 double predict_base_elapsed_time_ms(size_t pending_cards); 492 double predict_base_elapsed_time_ms(size_t pending_cards);
498 double predict_base_elapsed_time_ms(size_t pending_cards, 493 double predict_base_elapsed_time_ms(size_t pending_cards,
499 size_t scanned_cards); 494 size_t scanned_cards);
705 // will stay true until the end of the initial-mark pause and it's 700 // will stay true until the end of the initial-mark pause and it's
706 // the condition that indicates that a pause is doing the 701 // the condition that indicates that a pause is doing the
707 // initial-mark work. 702 // initial-mark work.
708 volatile bool _during_initial_mark_pause; 703 volatile bool _during_initial_mark_pause;
709 704
710 bool _should_revert_to_young_gcs;
711 bool _last_young_gc; 705 bool _last_young_gc;
712 706
713 // This set of variables tracks the collector efficiency, in order to 707 // This set of variables tracks the collector efficiency, in order to
714 // determine whether we should initiate a new marking. 708 // determine whether we should initiate a new marking.
715 double _cur_mark_stop_world_time_ms; 709 double _cur_mark_stop_world_time_ms;
944 // The amount of space we copied during a GC. 938 // The amount of space we copied during a GC.
945 size_t bytes_copied_during_gc() { 939 size_t bytes_copied_during_gc() {
946 return _bytes_copied_during_gc; 940 return _bytes_copied_during_gc;
947 } 941 }
948 942
943 // Determine whether the next GC should be mixed. Called to determine
944 // whether to start mixed GCs or whether to carry on doing mixed
945 // GCs. The two action strings are used in the ergo output when the
946 // method returns true or false.
947 bool next_gc_should_be_mixed(const char* true_action_str,
948 const char* false_action_str);
949
949 // Choose a new collection set. Marks the chosen regions as being 950 // Choose a new collection set. Marks the chosen regions as being
950 // "in_collection_set", and links them together. The head and number of 951 // "in_collection_set", and links them together. The head and number of
951 // the collection set are available via access methods. 952 // the collection set are available via access methods.
952 void choose_collection_set(double target_pause_time_ms); 953 void finalize_cset(double target_pause_time_ms);
953 954
954 // The head of the list (via "next_in_collection_set()") representing the 955 // The head of the list (via "next_in_collection_set()") representing the
955 // current collection set. 956 // current collection set.
956 HeapRegion* collection_set() { return _collection_set; } 957 HeapRegion* collection_set() { return _collection_set; }
957 958