Skip to content

Commit

Permalink
8315765: G1: Incorrect use of G1LastPLABAverageOccupancy
Browse files Browse the repository at this point in the history
Reviewed-by: iwalulya, tschatzl
  • Loading branch information
albertnetymk committed Sep 11, 2023
1 parent 66b6a5a commit d06a564
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1Allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) :
if (ResizePLAB) {
// See G1EvacStats::compute_desired_plab_sz for the reasoning why this is the
// expected number of refills.
double const ExpectedNumberOfRefills = G1LastPLABAverageOccupancy / TargetPLABWastePct;
double const ExpectedNumberOfRefills = (100 - G1LastPLABAverageOccupancy) / TargetPLABWastePct;
// Add some padding to the threshold to not boost exactly when the targeted refills
// were reached.
// E.g. due to limitation of PLAB size to non-humongous objects and region boundaries
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1EvacStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ size_t G1EvacStats::compute_desired_plab_size() const {
// also assume that that buffer is typically half-full (G1LastPLABAverageOccupancy),
// the new desired PLAB size is set to 20 words.
//
// (This also implies that we expect G1LastPLABAverageOccupancy/TargetPLABWastePct
// (This also implies that we expect (100-G1LastPLABAverageOccupancy)/TargetPLABWastePct
// number of refills during allocation).
//
// The amount of allocation performed should be independent of the number of
Expand Down Expand Up @@ -113,7 +113,7 @@ size_t G1EvacStats::compute_desired_plab_size() const {
size_t const used_for_waste_calculation = used() > _region_end_waste ? used() - _region_end_waste : 0;

size_t const total_waste_allowed = used_for_waste_calculation * TargetPLABWastePct;
return (size_t)((double)total_waste_allowed / G1LastPLABAverageOccupancy);
return (size_t)((double)total_waste_allowed / (100 - G1LastPLABAverageOccupancy));
}

G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt) :
Expand Down

1 comment on commit d06a564

@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.