8150952: Net PLAB size is clipped to max PLAB size as a whole, not on a per thread basis
authortschatzl
Fri, 11 Mar 2016 09:50:23 +0100
changeset 37068 fd8357c31be4
parent 37066 f4ebb8b35388
child 37069 732328249e62
8150952: Net PLAB size is clipped to max PLAB size as a whole, not on a per thread basis Summary: Bound PLAB size when handing out PLAB sizes, not before. Reviewed-by: drwhite, jwilhelm
hotspot/src/share/vm/gc/g1/g1EvacStats.cpp
hotspot/src/share/vm/gc/shared/plab.cpp
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Thu Mar 10 21:57:27 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Fri Mar 11 09:50:23 2016 +0100
@@ -110,15 +110,9 @@
   size_t const cur_plab_sz = (size_t)((double)total_waste_allowed / G1LastPLABAverageOccupancy);
   // Take historical weighted average
   _filter.sample(cur_plab_sz);
-  // Clip from above and below, and align to object boundary
-  size_t plab_sz;
-  plab_sz = MAX2(min_size(), (size_t)_filter.average());
-  plab_sz = MIN2(max_size(), plab_sz);
-  plab_sz = align_object_size(plab_sz);
-  // Latch the result
-  _desired_net_plab_sz = plab_sz;
+  _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average());
 
-  log_sizing(cur_plab_sz, plab_sz);
+  log_sizing(cur_plab_sz, _desired_net_plab_sz);
   // Clear accumulators for next round.
   reset();
 }
--- a/hotspot/src/share/vm/gc/shared/plab.cpp	Thu Mar 10 21:57:27 2016 +0000
+++ b/hotspot/src/share/vm/gc/shared/plab.cpp	Fri Mar 11 09:50:23 2016 +0100
@@ -136,7 +136,7 @@
 
 // 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));
+  return (size_t)align_object_size(MIN2(MAX2(min_size(), _desired_net_plab_sz / no_of_gc_workers), max_size()));
 }
 
 // Compute desired plab size for one gc worker thread and latch result for later
@@ -175,14 +175,9 @@
   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
-  size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average());
-  new_plab_sz = MIN2(max_size(), new_plab_sz);
-  new_plab_sz = align_object_size(new_plab_sz);
-  // Latch the result
-  _desired_net_plab_sz = new_plab_sz;
+  _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average());
 
-  log_sizing(recent_plab_sz, new_plab_sz);
+  log_sizing(recent_plab_sz, _desired_net_plab_sz);
 
   reset();
 }