RFR: Fix ShHeap::notify_alloc usages: it accepts words, not bytes
Aleksey Shipilev
shade at redhat.com
Wed Aug 22 09:24:23 UTC 2018
There is a little bug in tracking the current allocated size, which trips the new alloc-rate-based
heuristics off. The argument for notify_alloc is words, not bytes. Fix:
diff -r a98f127f8c22 src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp Wed Aug 22 10:50:28 2018 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp Wed Aug 22 11:22:41 2018 +0200
@@ -218,5 +218,5 @@
if (waste > 0) {
increase_used(waste);
- _heap->notify_alloc(waste, true);
+ _heap->notify_alloc_words(waste >> LogHeapWordSize, true);
}
@@ -329,5 +329,5 @@
if (remainder != 0) {
// Record this remainder as allocation waste
- _heap->notify_alloc(ShenandoahHeapRegion::region_size_words() - remainder, true);
+ _heap->notify_alloc_words(ShenandoahHeapRegion::region_size_words() - remainder, true);
}
diff -r a98f127f8c22 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Wed Aug 22 10:50:28 2018 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Wed Aug 22 11:22:41 2018 +0200
@@ -648,5 +648,5 @@
}
-void ShenandoahHeap::notify_alloc(size_t words, bool waste) {
+void ShenandoahHeap::notify_alloc_words(size_t words, bool waste) {
size_t bytes = words * HeapWordSize;
if (!waste) {
@@ -865,5 +865,5 @@
alloc_type_to_string(req.type()), requested, actual);
- notify_alloc(actual, false);
+ notify_alloc_words(actual, false);
// If we requested more than we were granted, give the rest back to pacer.
diff -r a98f127f8c22 src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Wed Aug 22 10:50:28 2018 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Wed Aug 22 11:22:41 2018 +0200
@@ -515,5 +515,5 @@
void increase_allocated(size_t bytes);
- void notify_alloc(size_t words, bool waste);
+ void notify_alloc_words(size_t words, bool waste);
Testing: misbehaving heuristics, tier1_gc_shenandoah
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list