8315031: YoungPLABSize and OldPLABSize not aligned by ObjectAlignmentInBytes

Reviewed-by: tschatzl, iwalulya
This commit is contained in:
Albert Mingkun Yang 2023-09-28 17:13:10 +00:00
parent 3481a48571
commit 060db1b2a2
2 changed files with 10 additions and 1 deletions

View File

@ -133,7 +133,9 @@ G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab
// Calculates plab size for current number of gc worker threads.
size_t G1EvacStats::desired_plab_size(uint no_of_gc_workers) const {
if (!ResizePLAB) {
return _default_plab_size;
// There is a circular dependency between the heap and PLAB initialization,
// so _default_plab_size can have an unaligned value.
return align_object_size(_default_plab_size);
}
return align_object_size(clamp(_desired_net_plab_size / no_of_gc_workers, min_size(), max_size()));
}

View File

@ -51,6 +51,13 @@ void PLAB::startup_initialization() {
FLAG_SET_ERGO(OldPLABSize, MAX2(ThreadLocalAllocBuffer::min_size(), OldPLABSize));
}
}
uint obj_alignment = checked_cast<uint>(ObjectAlignmentInBytes / HeapWordSize);
if (!is_aligned(YoungPLABSize, obj_alignment)) {
FLAG_SET_ERGO(YoungPLABSize, align_up(YoungPLABSize, obj_alignment));
}
if (!is_aligned(OldPLABSize, obj_alignment)) {
FLAG_SET_ERGO(OldPLABSize, align_up(OldPLABSize, obj_alignment));
}
}
PLAB::PLAB(size_t desired_plab_sz_) :