diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index 4d626d9af2d..cf44b68fc86 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -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 diff --git a/src/hotspot/share/gc/g1/g1EvacStats.cpp b/src/hotspot/share/gc/g1/g1EvacStats.cpp index 85ec939e79e..fe92c9380ba 100644 --- a/src/hotspot/share/gc/g1/g1EvacStats.cpp +++ b/src/hotspot/share/gc/g1/g1EvacStats.cpp @@ -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 @@ -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) :