Skip to content

Commit

Permalink
8315031: YoungPLABSize and OldPLABSize not aligned by ObjectAlignment…
Browse files Browse the repository at this point in the history
…InBytes

Reviewed-by: tschatzl, iwalulya
  • Loading branch information
albertnetymk committed Sep 28, 2023
1 parent 3481a48 commit 060db1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hotspot/share/gc/g1/g1EvacStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down
7 changes: 7 additions & 0 deletions src/hotspot/share/gc/shared/plab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_) :
Expand Down

1 comment on commit 060db1b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.