8257145: Performance regression with -XX:-ResizePLAB after JDK-8079555

Co-authored-by: Junjun Lin <linjunjun@huawei.com>
Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Dongbo He 2020-12-11 09:06:10 +00:00 committed by Fei Yang
parent fa20186cb6
commit b28b0947d9
5 changed files with 12 additions and 6 deletions
src/hotspot/share/gc
test/hotspot/jtreg/gc/g1/plab

@ -27,6 +27,7 @@
#include "gc/shared/gcId.hpp"
#include "logging/log.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/globals.hpp"
void G1EvacStats::log_plab_allocation() {
PLABStats::log_plab_allocation();
@ -88,8 +89,8 @@ size_t G1EvacStats::compute_desired_plab_sz() {
return cur_plab_sz;
}
G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) :
PLABStats(description, desired_plab_sz_, wt),
G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt) :
PLABStats(description, default_per_thread_plab_size, default_per_thread_plab_size * ParallelGCThreads, wt),
_region_end_waste(0),
_regions_filled(0),
_direct_allocated(0),

@ -56,7 +56,7 @@ class G1EvacStats : public PLABStats {
virtual size_t compute_desired_plab_sz();
public:
G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt);
~G1EvacStats();

@ -135,6 +135,9 @@ void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) {
// Calculates plab size for current number of gc worker threads.
size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
if (!ResizePLAB) {
return _default_plab_sz;
}
return align_object_size(clamp(_desired_net_plab_sz / no_of_gc_workers, min_size(), max_size()));
}

@ -151,6 +151,7 @@ class PLABStats : public CHeapObj<mtGC> {
size_t _wasted; // of which wasted (internal fragmentation)
size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
size_t _unused; // Unused in last buffer
size_t _default_plab_sz;
size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
AdaptiveWeightedAverage
_filter; // Integrator with decay
@ -169,13 +170,14 @@ class PLABStats : public CHeapObj<mtGC> {
virtual size_t compute_desired_plab_sz();
public:
PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
PLABStats(const char* description, size_t default_per_thread_plab_size, size_t desired_net_plab_sz, unsigned wt) :
_description(description),
_allocated(0),
_wasted(0),
_undo_wasted(0),
_unused(0),
_desired_net_plab_sz(desired_net_plab_sz_),
_default_plab_sz(default_per_thread_plab_size),
_desired_net_plab_sz(desired_net_plab_sz),
_filter(wt)
{ }

@ -72,7 +72,7 @@ public class TestPLABPromotion {
private static final int PLAB_SIZE_HIGH = 65536;
private static final int OBJECT_SIZE_SMALL = 10;
private static final int OBJECT_SIZE_MEDIUM = 100;
private static final int OBJECT_SIZE_HIGH = 1000;
private static final int OBJECT_SIZE_HIGH = 3500;
private static final int GC_NUM_SMALL = 1;
private static final int GC_NUM_MEDIUM = 3;
private static final int GC_NUM_HIGH = 7;