< prev index next >

src/share/vm/gc/g1/g1CollectorPolicy.cpp

Print this page
rev 9312 : imported patch 8136678-implement-adaptive-sizing-algorithm-for-IHOP

*** 1243,1254 **** --- 1243,1271 ---- _collectionSetChooser->verify(); } G1IHOPControl* G1CollectorPolicy::create_ihop_control() const { + if (G1UseAdaptiveIHOP) { + // The target occupancy is the total heap occupancy we want to hit. First, we + // want to avoid eating into the reserve intended for young GC (to avoid unnecessary + // throughput loss). Additionally G1 is free to not clean out up to + // G1HeapWastePercent of heap, that space also cannot be used for allocation + // while marking. + size_t safe_heap_percentage = (size_t) (G1ReservePercent + G1HeapWastePercent); + size_t target_occupancy = 0; + + if (safe_heap_percentage < 100) { + target_occupancy = G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_heap_percentage) / 100.0; + } + return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent, + target_occupancy, + &_predictor); + } else { return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent, G1CollectedHeap::heap()->max_capacity()); + } } void G1CollectorPolicy::update_ihop_statistics(double marking_time, double mutator_time_s, size_t mutator_alloc_bytes,
< prev index next >