--- old/src/hotspot/share/gc/g1/g1MMUTracker.cpp 2020-08-25 12:56:21.000000000 +0200 +++ new/src/hotspot/share/gc/g1/g1MMUTracker.cpp 2020-08-25 12:56:20.000000000 +0200 @@ -76,7 +76,6 @@ } void G1MMUTrackerQueue::add_pause(double start, double end) { - double duration = end - start; remove_expired_entries(end); if (_no_entries == QueueLength) { @@ -127,6 +126,11 @@ if (is_double_leq_0(diff)) return 0.0; + if (adjusted_pause_time == max_gc_time()) { + G1MMUTrackerQueueElem *elem = &_array[_head_index]; + return elem->end_time() - limit; + } + int index = _tail_index; while ( 1 ) { G1MMUTrackerQueueElem *elem = &_array[index]; @@ -136,7 +140,7 @@ else diff -= elem->end_time() - limit; if (is_double_leq_0(diff)) - return elem->end_time() + diff + _time_slice - adjusted_pause_time - current_time; + return elem->end_time() + diff - limit; } index = trim_index(index+1); guarantee(index != trim_index(_head_index + 1), "should not go past head");