comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @ 1145:e018e6884bd8

6631166: CMS: better heuristics when combatting fragmentation Summary: Autonomic per-worker free block cache sizing, tunable coalition policies, fixes to per-size block statistics, retuned gain and bandwidth of some feedback loop filters to allow quicker reactivity to abrupt changes in ambient demand, and other heuristics to reduce fragmentation of the CMS old gen. Also tightened some assertions, including those related to locking. Reviewed-by: jmasa
author ysr
date Wed, 23 Dec 2009 09:23:54 -0800
parents 05f89f00a864
children 0bfd3fb24150
comparison
equal deleted inserted replaced
1111:44f61c24ddab 1145:e018e6884bd8
352 // of change between old_duty_cycle and new_duty_cycle (the latter is treated 352 // of change between old_duty_cycle and new_duty_cycle (the latter is treated
353 // as a recommended value). 353 // as a recommended value).
354 static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle, 354 static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle,
355 unsigned int new_duty_cycle); 355 unsigned int new_duty_cycle);
356 unsigned int icms_update_duty_cycle_impl(); 356 unsigned int icms_update_duty_cycle_impl();
357
358 // In support of adjusting of cms trigger ratios based on history
359 // of concurrent mode failure.
360 double cms_free_adjustment_factor(size_t free) const;
361 void adjust_cms_free_adjustment_factor(bool fail, size_t free);
357 362
358 public: 363 public:
359 CMSStats(ConcurrentMarkSweepGeneration* cms_gen, 364 CMSStats(ConcurrentMarkSweepGeneration* cms_gen,
360 unsigned int alpha = CMSExpAvgFactor); 365 unsigned int alpha = CMSExpAvgFactor);
361 366
568 // Check whether the gc time limit has been 573 // Check whether the gc time limit has been
569 // exceeded and set the size policy flag 574 // exceeded and set the size policy flag
570 // appropriately. 575 // appropriately.
571 void check_gc_time_limit(); 576 void check_gc_time_limit();
572 // XXX Move these to CMSStats ??? FIX ME !!! 577 // XXX Move these to CMSStats ??? FIX ME !!!
573 elapsedTimer _sweep_timer; 578 elapsedTimer _inter_sweep_timer; // time between sweeps
574 AdaptivePaddedAverage _sweep_estimate; 579 elapsedTimer _intra_sweep_timer; // time _in_ sweeps
580 // padded decaying average estimates of the above
581 AdaptivePaddedAverage _inter_sweep_estimate;
582 AdaptivePaddedAverage _intra_sweep_estimate;
575 583
576 protected: 584 protected:
577 ConcurrentMarkSweepGeneration* _cmsGen; // old gen (CMS) 585 ConcurrentMarkSweepGeneration* _cmsGen; // old gen (CMS)
578 ConcurrentMarkSweepGeneration* _permGen; // perm gen 586 ConcurrentMarkSweepGeneration* _permGen; // perm gen
579 MemRegion _span; // span covering above two 587 MemRegion _span; // span covering above two
623 // next_state(Resetting) = {Idling} 631 // next_state(Resetting) = {Idling}
624 // The numeric values below are chosen so that: 632 // The numeric values below are chosen so that:
625 // . _collectorState <= Idling == post-sweep && pre-mark 633 // . _collectorState <= Idling == post-sweep && pre-mark
626 // . _collectorState in (Idling, Sweeping) == {initial,final}marking || 634 // . _collectorState in (Idling, Sweeping) == {initial,final}marking ||
627 // precleaning || abortablePrecleanb 635 // precleaning || abortablePrecleanb
636 public:
628 enum CollectorState { 637 enum CollectorState {
629 Resizing = 0, 638 Resizing = 0,
630 Resetting = 1, 639 Resetting = 1,
631 Idling = 2, 640 Idling = 2,
632 InitialMarking = 3, 641 InitialMarking = 3,
634 Precleaning = 5, 643 Precleaning = 5,
635 AbortablePreclean = 6, 644 AbortablePreclean = 6,
636 FinalMarking = 7, 645 FinalMarking = 7,
637 Sweeping = 8 646 Sweeping = 8
638 }; 647 };
648 protected:
639 static CollectorState _collectorState; 649 static CollectorState _collectorState;
640 650
641 // State related to prologue/epilogue invocation for my generations 651 // State related to prologue/epilogue invocation for my generations
642 bool _between_prologue_and_epilogue; 652 bool _between_prologue_and_epilogue;
643 653
653 bool _abort_preclean; 663 bool _abort_preclean;
654 bool _start_sampling; 664 bool _start_sampling;
655 665
656 int _numYields; 666 int _numYields;
657 size_t _numDirtyCards; 667 size_t _numDirtyCards;
658 uint _sweepCount; 668 size_t _sweep_count;
659 // number of full gc's since the last concurrent gc. 669 // number of full gc's since the last concurrent gc.
660 uint _full_gcs_since_conc_gc; 670 uint _full_gcs_since_conc_gc;
661 671
662 // occupancy used for bootstrapping stats 672 // occupancy used for bootstrapping stats
663 double _bootstrap_occupancy; 673 double _bootstrap_occupancy;
903 bool init_mark_was_synchronous); 913 bool init_mark_was_synchronous);
904 void sweep(bool asynch); 914 void sweep(bool asynch);
905 915
906 // Check that the currently executing thread is the expected 916 // Check that the currently executing thread is the expected
907 // one (foreground collector or background collector). 917 // one (foreground collector or background collector).
908 void check_correct_thread_executing() PRODUCT_RETURN; 918 static void check_correct_thread_executing() PRODUCT_RETURN;
909 // XXXPERM void print_statistics() PRODUCT_RETURN; 919 // XXXPERM void print_statistics() PRODUCT_RETURN;
910 920
911 bool is_cms_reachable(HeapWord* addr); 921 bool is_cms_reachable(HeapWord* addr);
912 922
913 // Performance Counter Support 923 // Performance Counter Support
928 938
929 static bool foregroundGCShouldWait() { return _foregroundGCShouldWait; } 939 static bool foregroundGCShouldWait() { return _foregroundGCShouldWait; }
930 static void set_foregroundGCShouldWait(bool v) { _foregroundGCShouldWait = v; } 940 static void set_foregroundGCShouldWait(bool v) { _foregroundGCShouldWait = v; }
931 static bool foregroundGCIsActive() { return _foregroundGCIsActive; } 941 static bool foregroundGCIsActive() { return _foregroundGCIsActive; }
932 static void set_foregroundGCIsActive(bool v) { _foregroundGCIsActive = v; } 942 static void set_foregroundGCIsActive(bool v) { _foregroundGCIsActive = v; }
933 uint sweepCount() const { return _sweepCount; } 943 size_t sweep_count() const { return _sweep_count; }
934 void incrementSweepCount() { _sweepCount++; } 944 void increment_sweep_count() { _sweep_count++; }
935 945
936 // Timers/stats for gc scheduling and incremental mode pacing. 946 // Timers/stats for gc scheduling and incremental mode pacing.
937 CMSStats& stats() { return _stats; } 947 CMSStats& stats() { return _stats; }
938 948
939 // Convenience methods that check whether CMSIncrementalMode is enabled and 949 // Convenience methods that check whether CMSIncrementalMode is enabled and
1162 virtual void par_promote_alloc_done(int thread_num); 1172 virtual void par_promote_alloc_done(int thread_num);
1163 virtual void par_oop_since_save_marks_iterate_done(int thread_num); 1173 virtual void par_oop_since_save_marks_iterate_done(int thread_num);
1164 1174
1165 virtual bool promotion_attempt_is_safe(size_t promotion_in_bytes, 1175 virtual bool promotion_attempt_is_safe(size_t promotion_in_bytes,
1166 bool younger_handles_promotion_failure) const; 1176 bool younger_handles_promotion_failure) const;
1177
1178 // Inform this (non-young) generation that a promotion failure was
1179 // encountered during a collection of a younger generation that
1180 // promotes into this generation.
1181 virtual void promotion_failure_occurred();
1167 1182
1168 bool should_collect(bool full, size_t size, bool tlab); 1183 bool should_collect(bool full, size_t size, bool tlab);
1169 virtual bool should_concurrent_collect() const; 1184 virtual bool should_concurrent_collect() const;
1170 virtual bool is_too_full() const; 1185 virtual bool is_too_full() const;
1171 void collect(bool full, 1186 void collect(bool full,