Skip to content

Commit

Permalink
8338444: Shenandoah: Remove ShenandoahHumongousThreshold tunable
Browse files Browse the repository at this point in the history
Reviewed-by: rkennke, wkemper, ysr
  • Loading branch information
shipilev authored and earthling-amzn committed Oct 8, 2024
1 parent 956a98f commit f3faa1a
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 323 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void ShenandoahAsserts::assert_in_correct_region(void* interior_loc, oop obj, co
}

size_t alloc_size = obj->size();
if (alloc_size > ShenandoahHeapRegion::humongous_threshold_words()) {
if (ShenandoahHeapRegion::requires_humongous(alloc_size)) {
size_t idx = r->index();
size_t num_regions = ShenandoahHeapRegion::required_regions(alloc_size * HeapWordSize);
for (size_t i = idx; i < idx + num_regions; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void ShenandoahController::handle_alloc_failure(ShenandoahAllocRequest& req, boo
ShenandoahHeap* heap = ShenandoahHeap::heap();

assert(current()->is_Java_thread(), "expect Java thread here");
bool is_humongous = req.size() > ShenandoahHeapRegion::humongous_threshold_words();
bool is_humongous = ShenandoahHeapRegion::requires_humongous(req.size());

if (try_set_alloc_failure_gc(is_humongous)) {
// Only report the first allocation failure
Expand All @@ -80,7 +80,7 @@ void ShenandoahController::handle_alloc_failure(ShenandoahAllocRequest& req, boo

void ShenandoahController::handle_alloc_failure_evac(size_t words) {
ShenandoahHeap* heap = ShenandoahHeap::heap();
bool is_humongous = (words > ShenandoahHeapRegion::region_size_words());
bool is_humongous = ShenandoahHeapRegion::requires_humongous(words);

if (try_set_alloc_failure_gc(is_humongous)) {
// Only report the first allocation failure
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ void ShenandoahFreeSet::log_status() {

HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_region) {
shenandoah_assert_heaplocked();
if (req.size() > ShenandoahHeapRegion::humongous_threshold_words()) {
if (ShenandoahHeapRegion::requires_humongous(req.size())) {
switch (req.type()) {
case ShenandoahAllocRequest::_alloc_shared:
case ShenandoahAllocRequest::_alloc_shared_gc:
Expand All @@ -1998,8 +1998,7 @@ HeapWord* ShenandoahFreeSet::allocate(ShenandoahAllocRequest& req, bool& in_new_
case ShenandoahAllocRequest::_alloc_gclab:
case ShenandoahAllocRequest::_alloc_tlab:
in_new_region = false;
assert(false, "Trying to allocate TLAB larger than the humongous threshold: " SIZE_FORMAT " > " SIZE_FORMAT,
req.size(), ShenandoahHeapRegion::humongous_threshold_words());
assert(false, "Trying to allocate TLAB in humongous region: " SIZE_FORMAT, req.size());
return nullptr;
default:
ShouldNotReachHere();
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,14 @@ class ShenandoahFreeSet : public CHeapObj<mtGC> {
// While holding the heap lock, allocate memory for a single object or LAB which is to be entirely contained
// within a single HeapRegion as characterized by req.
//
// Precondition: req.size() <= ShenandoahHeapRegion::humongous_threshold_words().
// Precondition: !ShenandoahHeapRegion::requires_humongous(req.size())
HeapWord* allocate_single(ShenandoahAllocRequest& req, bool& in_new_region);

// While holding the heap lock, allocate memory for a humongous object which spans one or more regions that
// were previously empty. Regions that represent humongous objects are entirely dedicated to the humongous
// object. No other objects are packed into these regions.
//
// Precondition: req.size() > ShenandoahHeapRegion::humongous_threshold_words().
// Precondition: ShenandoahHeapRegion::requires_humongous(req.size())
HeapWord* allocate_contiguous(ShenandoahAllocRequest& req);

// Change region r from the Mutator partition to the GC's Collector or OldCollector partition. This requires that the
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ void ShenandoahHeap::increase_used(const ShenandoahAllocRequest& req) {
// notify pacer of both actual size and waste
notify_mutator_alloc_words(req.actual_size(), req.waste());

if (wasted_bytes > 0 && req.actual_size() > ShenandoahHeapRegion::humongous_threshold_words()) {
if (wasted_bytes > 0 && ShenandoahHeapRegion::requires_humongous(req.actual_size())) {
increase_humongous_waste(generation,wasted_bytes);
}
}
Expand Down
14 changes: 1 addition & 13 deletions src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ size_t ShenandoahHeapRegion::RegionSizeBytesShift = 0;
size_t ShenandoahHeapRegion::RegionSizeWordsShift = 0;
size_t ShenandoahHeapRegion::RegionSizeBytesMask = 0;
size_t ShenandoahHeapRegion::RegionSizeWordsMask = 0;
size_t ShenandoahHeapRegion::HumongousThresholdBytes = 0;
size_t ShenandoahHeapRegion::HumongousThresholdWords = 0;
size_t ShenandoahHeapRegion::MaxTLABSizeBytes = 0;
size_t ShenandoahHeapRegion::MaxTLABSizeWords = 0;

Expand Down Expand Up @@ -747,18 +745,8 @@ size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
RegionCount = align_up(max_heap_size, RegionSizeBytes) / RegionSizeBytes;
guarantee(RegionCount >= MIN_NUM_REGIONS, "Should have at least minimum regions");

guarantee(HumongousThresholdWords == 0, "we should only set it once");
HumongousThresholdWords = RegionSizeWords * ShenandoahHumongousThreshold / 100;
HumongousThresholdWords = align_down(HumongousThresholdWords, MinObjAlignment);
assert (HumongousThresholdWords <= RegionSizeWords, "sanity");

guarantee(HumongousThresholdBytes == 0, "we should only set it once");
HumongousThresholdBytes = HumongousThresholdWords * HeapWordSize;
assert (HumongousThresholdBytes <= RegionSizeBytes, "sanity");

guarantee(MaxTLABSizeWords == 0, "we should only set it once");
MaxTLABSizeWords = MIN2(RegionSizeWords, HumongousThresholdWords);
MaxTLABSizeWords = align_down(MaxTLABSizeWords, MinObjAlignment);
MaxTLABSizeWords = align_down(RegionSizeWords, MinObjAlignment);

guarantee(MaxTLABSizeBytes == 0, "we should only set it once");
MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize;
Expand Down
14 changes: 4 additions & 10 deletions src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ class ShenandoahHeapRegion {
static size_t RegionSizeWordsShift;
static size_t RegionSizeBytesMask;
static size_t RegionSizeWordsMask;
static size_t HumongousThresholdBytes;
static size_t HumongousThresholdWords;
static size_t MaxTLABSizeBytes;
static size_t MaxTLABSizeWords;

Expand Down Expand Up @@ -279,6 +277,10 @@ class ShenandoahHeapRegion {
return (bytes + ShenandoahHeapRegion::region_size_bytes() - 1) >> ShenandoahHeapRegion::region_size_bytes_shift();
}

inline static bool requires_humongous(size_t words) {
return words > ShenandoahHeapRegion::RegionSizeWords;
}

inline static size_t region_count() {
return ShenandoahHeapRegion::RegionCount;
}
Expand Down Expand Up @@ -331,14 +333,6 @@ class ShenandoahHeapRegion {
return (jint)ShenandoahHeapRegion::RegionSizeWordsShift;
}

inline static size_t humongous_threshold_bytes() {
return ShenandoahHeapRegion::HumongousThresholdBytes;
}

inline static size_t humongous_threshold_words() {
return ShenandoahHeapRegion::HumongousThresholdWords;
}

inline static size_t max_tlab_size_bytes() {
return ShenandoahHeapRegion::MaxTLABSizeBytes;
}
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahInitLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void ShenandoahInitLogger::print_heap() {
log_info(gc, init)("Heap Region Count: " SIZE_FORMAT, ShenandoahHeapRegion::region_count());
log_info(gc, init)("Heap Region Size: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::region_size_bytes()));
log_info(gc, init)("TLAB Size Max: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::max_tlab_size_bytes()));
log_info(gc, init)("Humongous Object Threshold: " EXACTFMT, EXACTFMTARGS(ShenandoahHeapRegion::humongous_threshold_bytes()));
}

void ShenandoahInitLogger::print_gc_specific() {
Expand Down
7 changes: 0 additions & 7 deletions src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@
"With automatic region sizing, the regions would be at most " \
"this large.") \
\
product(intx, ShenandoahHumongousThreshold, 100, EXPERIMENTAL, \
"Humongous objects are allocated in separate regions. " \
"This setting defines how large the object should be to be " \
"deemed humongous. Value is in percents of heap region size. " \
"This also caps the maximum TLAB size.") \
range(1, 100) \
\
product(ccstr, ShenandoahGCMode, "satb", \
"GC mode to use. Among other things, this defines which " \
"barriers are in in use. Possible values are:" \
Expand Down
Loading

0 comments on commit f3faa1a

Please sign in to comment.