< prev index next >

src/hotspot/share/gc/shenandoah/heuristics/shenandoahGlobalHeuristics.cpp

Print this page

 36 
 37 
 38 void ShenandoahGlobalHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
 39                                                                        RegionData* data, size_t size,
 40                                                                        size_t actual_free) {
 41   // Better select garbage-first regions
 42   QuickSort::sort<RegionData>(data, (int) size, compare_by_garbage);
 43 
 44   choose_global_collection_set(cset, data, size, actual_free, 0 /* cur_young_garbage */);
 45 
 46   log_cset_composition(cset);
 47 }
 48 
 49 
 50 void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollectionSet* cset,
 51                                                               const ShenandoahHeuristics::RegionData* data,
 52                                                               size_t size, size_t actual_free,
 53                                                               size_t cur_young_garbage) const {
 54   auto heap = ShenandoahGenerationalHeap::heap();
 55   size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes();
 56   size_t capacity = heap->young_generation()->max_capacity();
 57   size_t garbage_threshold = region_size_bytes * ShenandoahGarbageThreshold / 100;
 58   size_t ignore_threshold = region_size_bytes * ShenandoahIgnoreGarbageThreshold / 100;
 59   const uint tenuring_threshold = heap->age_census()->tenuring_threshold();
 60 
 61   size_t young_evac_reserve = heap->young_generation()->get_evacuation_reserve();
 62   size_t old_evac_reserve = heap->old_generation()->get_evacuation_reserve();
 63   size_t max_young_cset = (size_t) (young_evac_reserve / ShenandoahEvacWaste);
 64   size_t young_cur_cset = 0;
 65   size_t max_old_cset = (size_t) (old_evac_reserve / ShenandoahOldEvacWaste);
 66   size_t old_cur_cset = 0;
 67 
 68   // Figure out how many unaffiliated young regions are dedicated to mutator and to evacuator.  Allow the young
 69   // collector's unaffiliated regions to be transferred to old-gen if old-gen has more easily reclaimed garbage
 70   // than young-gen.  At the end of this cycle, any excess regions remaining in old-gen will be transferred back
 71   // to young.  Do not transfer the mutator's unaffiliated regions to old-gen.  Those must remain available
 72   // to the mutator as it needs to be able to consume this memory during concurrent GC.
 73 
 74   size_t unaffiliated_young_regions = heap->young_generation()->free_unaffiliated_regions();
 75   size_t unaffiliated_young_memory = unaffiliated_young_regions * region_size_bytes;
 76 

 36 
 37 
 38 void ShenandoahGlobalHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
 39                                                                        RegionData* data, size_t size,
 40                                                                        size_t actual_free) {
 41   // Better select garbage-first regions
 42   QuickSort::sort<RegionData>(data, (int) size, compare_by_garbage);
 43 
 44   choose_global_collection_set(cset, data, size, actual_free, 0 /* cur_young_garbage */);
 45 
 46   log_cset_composition(cset);
 47 }
 48 
 49 
 50 void ShenandoahGlobalHeuristics::choose_global_collection_set(ShenandoahCollectionSet* cset,
 51                                                               const ShenandoahHeuristics::RegionData* data,
 52                                                               size_t size, size_t actual_free,
 53                                                               size_t cur_young_garbage) const {
 54   auto heap = ShenandoahGenerationalHeap::heap();
 55   size_t region_size_bytes = ShenandoahHeapRegion::region_size_bytes();
 56   size_t capacity = heap->soft_max_capacity();
 57   size_t garbage_threshold = region_size_bytes * ShenandoahGarbageThreshold / 100;
 58   size_t ignore_threshold = region_size_bytes * ShenandoahIgnoreGarbageThreshold / 100;
 59   const uint tenuring_threshold = heap->age_census()->tenuring_threshold();
 60 
 61   size_t young_evac_reserve = heap->young_generation()->get_evacuation_reserve();
 62   size_t old_evac_reserve = heap->old_generation()->get_evacuation_reserve();
 63   size_t max_young_cset = (size_t) (young_evac_reserve / ShenandoahEvacWaste);
 64   size_t young_cur_cset = 0;
 65   size_t max_old_cset = (size_t) (old_evac_reserve / ShenandoahOldEvacWaste);
 66   size_t old_cur_cset = 0;
 67 
 68   // Figure out how many unaffiliated young regions are dedicated to mutator and to evacuator.  Allow the young
 69   // collector's unaffiliated regions to be transferred to old-gen if old-gen has more easily reclaimed garbage
 70   // than young-gen.  At the end of this cycle, any excess regions remaining in old-gen will be transferred back
 71   // to young.  Do not transfer the mutator's unaffiliated regions to old-gen.  Those must remain available
 72   // to the mutator as it needs to be able to consume this memory during concurrent GC.
 73 
 74   size_t unaffiliated_young_regions = heap->young_generation()->free_unaffiliated_regions();
 75   size_t unaffiliated_young_memory = unaffiliated_young_regions * region_size_bytes;
 76 
< prev index next >