RFR: Avoid notifying about zero waste

Aleksey Shipilev shade at redhat.com
Fri Apr 6 15:32:54 UTC 2018


We do not need to notify anyone about zero waste when region is retiring:

diff -r 889aec72fd97 src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp	Fri Apr 06 17:13:42 2018 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp	Fri Apr 06 17:32:07 2018 +0200
@@ -202,12 +202,15 @@
     // fit, but the next small one would, we are risking to inflate scan times when lots of
     // almost-full regions precede the fully-empty region where we want allocate the entire TLAB.
     // TODO: Record first fully-empty region, and use that for large allocations
+
+    // Record the remainder as allocation waste
+    size_t waste = r->free();
+    if (waste > 0) {
+      increase_used(waste);
+      _heap->notify_alloc(waste, true);
+    }
+
     size_t num = r->region_number();
-    increase_used(r->free());
-
-    // Record this remainder as allocation waste
-    _heap->notify_alloc(r->free(), true);
-
     _collector_free_bitmap.clear_bit(num);
     _mutator_free_bitmap.clear_bit(num);
     // Touched the bounds? Need to update:

Testing: hotspot_gc_shenandoah, benchmarks

Thanks,
-Aleksey


More information about the shenandoah-dev mailing list