< prev index next >

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

Print this page

51 
52 void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
53                                                                         RegionData* data, size_t size,
54                                                                         size_t actual_free) {
55   assert(ShenandoahDegeneratedGC, "This path is only taken for Degenerated GC");
56 
57   // Do not select too large CSet that would overflow the available free space.
58   // Take at least the entire evacuation reserve, and be free to overflow to free space.
59   size_t max_capacity = _space_info->max_capacity();
60   size_t available = MAX2(max_capacity / 100 * ShenandoahEvacReserve, actual_free);
61   size_t max_cset  = (size_t)(available / ShenandoahEvacWaste);
62 
63   log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s",
64                      byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free),
65                      byte_size_in_proper_unit(max_cset),    proper_unit_for_byte_size(max_cset));
66 
67   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
68 
69   size_t live_cset = 0;
70   for (size_t idx = 0; idx < size; idx++) {
71     ShenandoahHeapRegion* r = data[idx]._region;
72     size_t new_cset = live_cset + r->get_live_data_bytes();
73     if (new_cset < max_cset && r->garbage() > threshold) {
74       live_cset = new_cset;
75       cset->add_region(r);
76     }
77   }
78 }

51 
52 void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
53                                                                         RegionData* data, size_t size,
54                                                                         size_t actual_free) {
55   assert(ShenandoahDegeneratedGC, "This path is only taken for Degenerated GC");
56 
57   // Do not select too large CSet that would overflow the available free space.
58   // Take at least the entire evacuation reserve, and be free to overflow to free space.
59   size_t max_capacity = _space_info->max_capacity();
60   size_t available = MAX2(max_capacity / 100 * ShenandoahEvacReserve, actual_free);
61   size_t max_cset  = (size_t)(available / ShenandoahEvacWaste);
62 
63   log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s",
64                      byte_size_in_proper_unit(actual_free), proper_unit_for_byte_size(actual_free),
65                      byte_size_in_proper_unit(max_cset),    proper_unit_for_byte_size(max_cset));
66 
67   size_t threshold = ShenandoahHeapRegion::region_size_bytes() * ShenandoahGarbageThreshold / 100;
68 
69   size_t live_cset = 0;
70   for (size_t idx = 0; idx < size; idx++) {
71     ShenandoahHeapRegion* r = data[idx].get_region();
72     size_t new_cset = live_cset + r->get_live_data_bytes();
73     if (new_cset < max_cset && r->garbage() > threshold) {
74       live_cset = new_cset;
75       cset->add_region(r);
76     }
77   }
78 }
< prev index next >