Skip to content

Commit d06a564

Browse files
committed
8315765: G1: Incorrect use of G1LastPLABAverageOccupancy
Reviewed-by: iwalulya, tschatzl
1 parent 66b6a5a commit d06a564

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/hotspot/share/gc/g1/g1Allocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) :
339339
if (ResizePLAB) {
340340
// See G1EvacStats::compute_desired_plab_sz for the reasoning why this is the
341341
// expected number of refills.
342-
double const ExpectedNumberOfRefills = G1LastPLABAverageOccupancy / TargetPLABWastePct;
342+
double const ExpectedNumberOfRefills = (100 - G1LastPLABAverageOccupancy) / TargetPLABWastePct;
343343
// Add some padding to the threshold to not boost exactly when the targeted refills
344344
// were reached.
345345
// E.g. due to limitation of PLAB size to non-humongous objects and region boundaries

src/hotspot/share/gc/g1/g1EvacStats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ size_t G1EvacStats::compute_desired_plab_size() const {
8585
// also assume that that buffer is typically half-full (G1LastPLABAverageOccupancy),
8686
// the new desired PLAB size is set to 20 words.
8787
//
88-
// (This also implies that we expect G1LastPLABAverageOccupancy/TargetPLABWastePct
88+
// (This also implies that we expect (100-G1LastPLABAverageOccupancy)/TargetPLABWastePct
8989
// number of refills during allocation).
9090
//
9191
// The amount of allocation performed should be independent of the number of
@@ -113,7 +113,7 @@ size_t G1EvacStats::compute_desired_plab_size() const {
113113
size_t const used_for_waste_calculation = used() > _region_end_waste ? used() - _region_end_waste : 0;
114114

115115
size_t const total_waste_allowed = used_for_waste_calculation * TargetPLABWastePct;
116-
return (size_t)((double)total_waste_allowed / G1LastPLABAverageOccupancy);
116+
return (size_t)((double)total_waste_allowed / (100 - G1LastPLABAverageOccupancy));
117117
}
118118

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

0 commit comments

Comments
 (0)