--- a/hotspot/src/share/vm/gc/shared/plab.cpp Fri Jul 03 06:24:23 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/plab.cpp Tue Jul 07 06:37:10 2015 -0700
@@ -109,10 +109,15 @@
}
}
-// Compute desired plab size and latch result for later
+// Calculates plab size for current number of gc worker threads.
+size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
+ return MAX2(min_size(), (size_t)align_object_size(_desired_net_plab_sz / no_of_gc_workers));
+}
+
+// Compute desired plab size for one gc worker thread and latch result for later
// use. This should be called once at the end of parallel
// scavenge; it clears the sensor accumulators.
-void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) {
+void PLABStats::adjust_desired_plab_sz() {
assert(ResizePLAB, "Not set");
assert(is_object_aligned(max_size()) && min_size() <= max_size(),
@@ -135,7 +140,8 @@
target_refills = 1;
}
size_t used = _allocated - _wasted - _unused;
- size_t recent_plab_sz = used / (target_refills * no_of_gc_workers);
+ // Assumed to have 1 gc worker thread
+ size_t recent_plab_sz = used / target_refills;
// Take historical weighted average
_filter.sample(recent_plab_sz);
// Clip from above and below, and align to object boundary
@@ -144,9 +150,9 @@
new_plab_sz = align_object_size(new_plab_sz);
// Latch the result
if (PrintPLAB) {
- gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " desired_plab_sz = " SIZE_FORMAT ") ", recent_plab_sz, new_plab_sz);
+ gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " desired_net_plab_sz = " SIZE_FORMAT ") ", recent_plab_sz, new_plab_sz);
}
- _desired_plab_sz = new_plab_sz;
+ _desired_net_plab_sz = new_plab_sz;
reset();
}