8315765: G1: Incorrect use of G1LastPLABAverageOccupancy

Reviewed-by: iwalulya, tschatzl
This commit is contained in:
Albert Mingkun Yang 2023-09-11 14:42:10 +00:00
parent 66b6a5a84f
commit d06a564328
2 changed files with 3 additions and 3 deletions
src/hotspot/share/gc/g1

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

@ -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) :