< prev index next >

src/hotspot/share/gc/g1/g1IHOPControl.cpp

Print this page
rev 59704 : imported patch 8236073-softmaxheapsize

*** 1,7 **** /* ! * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 42,52 **** log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B", _target_occupancy, new_target_occupancy); _target_occupancy = new_target_occupancy; } ! void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) { assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s); _last_allocation_time_s = allocation_time_s; _last_allocated_bytes = allocated_bytes; } --- 42,52 ---- log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B", _target_occupancy, new_target_occupancy); _target_occupancy = new_target_occupancy; } ! void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes) { assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s); _last_allocation_time_s = allocation_time_s; _last_allocated_bytes = allocated_bytes; }
*** 87,102 **** size_t heap_waste_percent) : G1IHOPControl(ihop_percent), _heap_reserve_percent(heap_reserve_percent), _heap_waste_percent(heap_waste_percent), _predictor(predictor), ! _marking_times_s(10, 0.95), ! _allocation_rate_s(10, 0.95), _last_unrestrained_young_size(0) { } size_t G1AdaptiveIHOPControl::actual_target_threshold() const { guarantee(_target_occupancy > 0, "Target occupancy still not updated yet."); // The actual target threshold takes the heap reserve and the expected waste in // free space into account. // _heap_reserve is that part of the total heap capacity that is reserved for --- 87,113 ---- size_t heap_waste_percent) : G1IHOPControl(ihop_percent), _heap_reserve_percent(heap_reserve_percent), _heap_waste_percent(heap_waste_percent), _predictor(predictor), ! _marking_times_s(10), ! _allocation_rate_s(10), _last_unrestrained_young_size(0) { } + void G1AdaptiveIHOPControl::update_target_occupancy(size_t new_target_occupancy) { + size_t old_target_occupancy = _target_occupancy; + G1IHOPControl::update_target_occupancy(new_target_occupancy); + + // When resizing the heap, as an estimate of the new value, scale the + // buffer needed linearly. + if (old_target_occupancy != 0) { + _last_unrestrained_young_size = _last_unrestrained_young_size * (new_target_occupancy / (double)old_target_occupancy); + } + } + size_t G1AdaptiveIHOPControl::actual_target_threshold() const { guarantee(_target_occupancy > 0, "Target occupancy still not updated yet."); // The actual target threshold takes the heap reserve and the expected waste in // free space into account. // _heap_reserve is that part of the total heap capacity that is reserved for
*** 106,116 **** // considered. double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0); return (size_t)MIN2( ! G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0, _target_occupancy * (100.0 - _heap_waste_percent) / 100.0 ); } double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const { --- 117,127 ---- // considered. double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0); return (size_t)MIN2( ! G1CollectedHeap::heap()->soft_max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0, _target_occupancy * (100.0 - _heap_waste_percent) / 100.0 ); } double G1AdaptiveIHOPControl::predict(TruncatedSeq const* seq) const {
*** 144,161 **** return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0); } } void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, ! size_t allocated_bytes, ! size_t additional_buffer_size) { ! G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size); double allocation_rate = (double) allocated_bytes / allocation_time_s; _allocation_rate_s.add(allocation_rate); ! _last_unrestrained_young_size = additional_buffer_size; } void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) { assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s); _marking_times_s.add(marking_length_s); --- 155,173 ---- return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0); } } void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, ! size_t allocated_bytes) { ! G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes); double allocation_rate = (double) allocated_bytes / allocation_time_s; _allocation_rate_s.add(allocation_rate); + } ! void G1AdaptiveIHOPControl::update_additional_buffer(size_t additional_buffer_bytes) { ! _last_unrestrained_young_size = additional_buffer_bytes; } void G1AdaptiveIHOPControl::update_marking_length(double marking_length_s) { assert(marking_length_s >= 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s); _marking_times_s.add(marking_length_s);
< prev index next >