Skip to content

Commit b28b094

Browse files
Dongbo HeJunjun Lin
authored andcommittedDec 11, 2020
8257145: Performance regression with -XX:-ResizePLAB after JDK-8079555
Co-authored-by: Junjun Lin <linjunjun@huawei.com> Reviewed-by: tschatzl, sjohanss
1 parent fa20186 commit b28b094

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed
 

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "gc/shared/gcId.hpp"
2828
#include "logging/log.hpp"
2929
#include "memory/allocation.inline.hpp"
30+
#include "runtime/globals.hpp"
3031

3132
void G1EvacStats::log_plab_allocation() {
3233
PLABStats::log_plab_allocation();
@@ -88,8 +89,8 @@ size_t G1EvacStats::compute_desired_plab_sz() {
8889
return cur_plab_sz;
8990
}
9091

91-
G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) :
92-
PLABStats(description, desired_plab_sz_, wt),
92+
G1EvacStats::G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt) :
93+
PLABStats(description, default_per_thread_plab_size, default_per_thread_plab_size * ParallelGCThreads, wt),
9394
_region_end_waste(0),
9495
_regions_filled(0),
9596
_direct_allocated(0),

‎src/hotspot/share/gc/g1/g1EvacStats.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class G1EvacStats : public PLABStats {
5656
virtual size_t compute_desired_plab_sz();
5757

5858
public:
59-
G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
59+
G1EvacStats(const char* description, size_t default_per_thread_plab_size, unsigned wt);
6060

6161
~G1EvacStats();
6262

‎src/hotspot/share/gc/shared/plab.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) {
135135

136136
// Calculates plab size for current number of gc worker threads.
137137
size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
138+
if (!ResizePLAB) {
139+
return _default_plab_sz;
140+
}
138141
return align_object_size(clamp(_desired_net_plab_sz / no_of_gc_workers, min_size(), max_size()));
139142
}
140143

‎src/hotspot/share/gc/shared/plab.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class PLABStats : public CHeapObj<mtGC> {
151151
size_t _wasted; // of which wasted (internal fragmentation)
152152
size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
153153
size_t _unused; // Unused in last buffer
154+
size_t _default_plab_sz;
154155
size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
155156
AdaptiveWeightedAverage
156157
_filter; // Integrator with decay
@@ -169,13 +170,14 @@ class PLABStats : public CHeapObj<mtGC> {
169170
virtual size_t compute_desired_plab_sz();
170171

171172
public:
172-
PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
173+
PLABStats(const char* description, size_t default_per_thread_plab_size, size_t desired_net_plab_sz, unsigned wt) :
173174
_description(description),
174175
_allocated(0),
175176
_wasted(0),
176177
_undo_wasted(0),
177178
_unused(0),
178-
_desired_net_plab_sz(desired_net_plab_sz_),
179+
_default_plab_sz(default_per_thread_plab_size),
180+
_desired_net_plab_sz(desired_net_plab_sz),
179181
_filter(wt)
180182
{ }
181183

‎test/hotspot/jtreg/gc/g1/plab/TestPLABPromotion.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class TestPLABPromotion {
7272
private static final int PLAB_SIZE_HIGH = 65536;
7373
private static final int OBJECT_SIZE_SMALL = 10;
7474
private static final int OBJECT_SIZE_MEDIUM = 100;
75-
private static final int OBJECT_SIZE_HIGH = 1000;
75+
private static final int OBJECT_SIZE_HIGH = 3500;
7676
private static final int GC_NUM_SMALL = 1;
7777
private static final int GC_NUM_MEDIUM = 3;
7878
private static final int GC_NUM_HIGH = 7;

0 commit comments

Comments
 (0)
Please sign in to comment.