Skip to content

Commit e81cf42

Browse files
committed
Calculation fix for soft_max_capacity
1 parent 42f352c commit e81cf42

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/hotspot/share/gc/z/zPageAllocator.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,11 @@ ZPageAllocatorStats ZPageAllocator::stats(ZGeneration* generation) const {
629629
state->_used_generations[gen_id]);
630630
}
631631

632-
// We can only calculate the soft_max_capcity after finding the combined value
633-
// for the current_max_capacity, so we set it after constructing the stats object.
632+
// We can only calculate the soft_max_capacity after finding the combined value
633+
// for current_max_capacity, so we set it after incrementing all the other stats.
634634
const size_t soft_max_heapsize = Atomic::load(&SoftMaxHeapSize);
635-
if (current_max_capacity > soft_max_heapsize) {
636-
stats.set_soft_max_capacity(current_max_capacity);
637-
}
635+
const size_t soft_max_capacity = MIN2(soft_max_heapsize, current_max_capacity);
636+
stats.set_soft_max_capacity(soft_max_capacity);
638637

639638
return stats;
640639
}

src/hotspot/share/gc/z/zPageAllocator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class ZPageAllocatorStats {
193193
size_t used_low() const;
194194
size_t used_generation() const;
195195

196-
void set_soft_max_capacity(size_t new_capacity);
196+
void set_soft_max_capacity(size_t soft_max_capacity);
197197
};
198198

199199
#endif // SHARE_GC_Z_ZPAGEALLOCATOR_HPP

src/hotspot/share/gc/z/zPageAllocator.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ inline size_t ZPageAllocatorStats::allocation_stalls() const {
106106
return _allocation_stalls;
107107
}
108108

109-
inline void ZPageAllocatorStats::set_soft_max_capacity(size_t new_capacity) {
110-
_soft_max_capacity = new_capacity;
109+
inline void ZPageAllocatorStats::set_soft_max_capacity(size_t soft_max_capacity) {
110+
_soft_max_capacity = soft_max_capacity;
111111
}
112112

113113
#endif // SHARE_GC_Z_ZPAGEALLOCATOR_INLINE_HPP

0 commit comments

Comments
 (0)