Skip to content

8350050: Shenandoah: remove support for ShenandoahPacing feature #24002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ void ShenandoahPassiveMode::initialize_flags() const {
FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false);
FLAG_SET_DEFAULT(ShenandoahImplicitGCInvokesConcurrent, false);

// Passive runs with max speed for allocation, because GC is always STW
SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahPacing);

// No need for evacuation reserve with Full GC, only for Degenerated GC.
if (!ShenandoahDegeneratedGC) {
SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool ShenandoahCollectorPolicy::should_handle_requested_gc(GCCause::Cause cause)
void ShenandoahCollectorPolicy::print_gc_stats(outputStream* out) const {
out->print_cr("Under allocation pressure, concurrent cycles may cancel, and either continue cycle");
out->print_cr("under stop-the-world pause or result in stop-the-world Full GC. Increase heap size,");
out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate");
out->print_cr("tune GC heuristics, or lower allocation rate");
out->print_cr("to avoid Degenerated and Full GC cycles. Abbreviated cycles are those which found");
out->print_cr("enough regions with no live objects to skip evacuation.");
out->cr();
Expand Down
15 changes: 2 additions & 13 deletions src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) {
entry_concurrent_update_refs_prepare(heap);

// Perform update-refs phase.
if (ShenandoahVerify || ShenandoahPacing) {
if (ShenandoahVerify) {
vmop_entry_init_update_refs();
}

Expand Down Expand Up @@ -629,9 +629,7 @@ void ShenandoahConcurrentGC::entry_reset_after_collect() {

void ShenandoahConcurrentGC::op_reset() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
if (ShenandoahPacing) {
heap->pacer()->setup_for_reset();
}

// If it is old GC bootstrap cycle, always clear bitmap for global gen
// to ensure bitmap for old gen is clear for old GC cycle after this.
if (_do_old_gc_bootstrap) {
Expand Down Expand Up @@ -743,9 +741,6 @@ void ShenandoahConcurrentGC::op_init_mark() {
ShenandoahCodeRoots::arm_nmethods_for_mark();

ShenandoahStackWatermark::change_epoch_id();
if (ShenandoahPacing) {
heap->pacer()->setup_for_mark();
}

{
ShenandoahTimingsTracker timing(ShenandoahPhaseTimings::init_propagate_gc_state);
Expand Down Expand Up @@ -806,9 +801,6 @@ void ShenandoahConcurrentGC::op_final_mark() {
ShenandoahCodeRoots::arm_nmethods_for_evac();
ShenandoahStackWatermark::change_epoch_id();

if (ShenandoahPacing) {
heap->pacer()->setup_for_evac();
}
} else {
if (ShenandoahVerify) {
ShenandoahTimingsTracker v(ShenandoahPhaseTimings::final_mark_verify);
Expand Down Expand Up @@ -1136,9 +1128,6 @@ void ShenandoahConcurrentGC::op_init_update_refs() {
ShenandoahTimingsTracker v(ShenandoahPhaseTimings::init_update_refs_verify);
heap->verifier()->verify_before_update_refs();
}
if (ShenandoahPacing) {
heap->pacer()->setup_for_update_refs();
}
}

void ShenandoahConcurrentGC::op_update_refs() {
Expand Down
20 changes: 0 additions & 20 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "gc/shenandoah/shenandoahGeneration.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
#include "gc/shenandoah/shenandoahPacer.inline.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "logging/log.hpp"
#include "memory/metaspaceStats.hpp"
Expand Down Expand Up @@ -69,9 +68,6 @@ void ShenandoahControlThread::run_service() {
const bool is_gc_requested = _gc_requested.is_set();
const GCCause::Cause requested_gc_cause = _requested_gc_cause;

// This control loop iteration has seen this much allocation.
const size_t allocs_seen = reset_allocs_seen();

// Choose which GC mode to run in. The block below should select a single mode.
GCMode mode = none;
GCCause::Cause cause = GCCause::_last_gc_cause;
Expand Down Expand Up @@ -204,9 +200,6 @@ void ShenandoahControlThread::run_service() {

// Commit worker statistics to cycle data
heap->phase_timings()->flush_par_workers_to_cycle();
if (ShenandoahPacing) {
heap->pacer()->flush_stats_to_cycle();
}

// Print GC stats for current cycle
{
Expand All @@ -215,9 +208,6 @@ void ShenandoahControlThread::run_service() {
ResourceMark rm;
LogStream ls(lt);
heap->phase_timings()->print_cycle_on(&ls);
if (ShenandoahPacing) {
heap->pacer()->print_cycle_on(&ls);
}
}
}

Expand All @@ -226,16 +216,6 @@ void ShenandoahControlThread::run_service() {

// Print Metaspace change following GC (if logging is enabled).
MetaspaceUtils::print_metaspace_change(meta_sizes);

// GC is over, we are at idle now
if (ShenandoahPacing) {
heap->pacer()->setup_for_idle();
}
} else {
// Report to pacer that we have seen this many words allocated
if (ShenandoahPacing && (allocs_seen > 0)) {
heap->pacer()->report_alloc(allocs_seen);
}
}

// Check if we have seen a new target for soft max heap size or if a gc was requested.
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/share/gc/shenandoah/shenandoahController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"

void ShenandoahController::pacing_notify_alloc(size_t words) {
assert(ShenandoahPacing, "should only call when pacing is enabled");
Atomic::add(&_allocs_seen, words, memory_order_relaxed);
}

size_t ShenandoahController::reset_allocs_seen() {
return Atomic::xchg(&_allocs_seen, (size_t)0, memory_order_relaxed);
}

void ShenandoahController::update_gc_id() {
Atomic::inc(&_gc_id);
Expand Down
13 changes: 1 addition & 12 deletions src/hotspot/share/gc/shenandoah/shenandoahController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@
class ShenandoahController: public ConcurrentGCThread {
private:
shenandoah_padding(0);
volatile size_t _allocs_seen;
shenandoah_padding(1);
// A monotonically increasing GC count.
volatile size_t _gc_id;
shenandoah_padding(2);
shenandoah_padding(1);

protected:
// While we could have a single lock for these, it may risk unblocking
Expand All @@ -55,7 +53,6 @@ class ShenandoahController: public ConcurrentGCThread {

public:
ShenandoahController():
_allocs_seen(0),
_gc_id(0),
_alloc_failure_waiters_lock(Mutex::safepoint-2, "ShenandoahAllocFailureGC_lock", true),
_gc_waiters_lock(Mutex::safepoint-2, "ShenandoahRequestedGC_lock", true)
Expand All @@ -76,14 +73,6 @@ class ShenandoahController: public ConcurrentGCThread {
// Notify threads waiting for GC to complete.
void notify_alloc_failure_waiters();

// This is called for every allocation. The control thread accumulates
// this value when idle. During the gc cycle, the control resets it
// and reports it to the pacer.
void pacing_notify_alloc(size_t words);

// Zeros out the number of allocations seen since the last GC cycle.
size_t reset_allocs_seen();

// Return the value of a monotonic increasing GC count, maintained by the control thread.
size_t get_gc_id();
};
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,10 +1263,6 @@ HeapWord* ShenandoahFreeSet::allocate_contiguous(ShenandoahAllocRequest& req) {
r->set_top(r->bottom() + used_words);
}
generation->increase_affiliated_region_count(num);
if (remainder != 0) {
// Record this remainder as allocation waste
_heap->notify_mutator_alloc_words(ShenandoahHeapRegion::region_size_words() - remainder, true);
}

// retire_range_from_partition() will adjust bounds on Mutator free set if appropriate
_partitions.retire_range_from_partition(ShenandoahFreeSetPartitionId::Mutator, beg, end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
#include "gc/shenandoah/shenandoahOldGC.hpp"
#include "gc/shenandoah/shenandoahOldGeneration.hpp"
#include "gc/shenandoah/shenandoahPacer.inline.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/shenandoahYoungGeneration.hpp"
#include "logging/log.hpp"
Expand All @@ -61,13 +60,9 @@ ShenandoahGenerationalControlThread::ShenandoahGenerationalControlThread() :

void ShenandoahGenerationalControlThread::run_service() {

const int64_t wait_ms = ShenandoahPacing ? ShenandoahControlIntervalMin : 0;
ShenandoahGCRequest request;
while (!should_terminate()) {

// This control loop iteration has seen this much allocation.
const size_t allocs_seen = reset_allocs_seen();

// Figure out if we have pending requests.
check_for_request(request);

Expand All @@ -77,11 +72,6 @@ void ShenandoahGenerationalControlThread::run_service() {

if (request.cause != GCCause::_no_gc) {
run_gc_cycle(request);
} else {
// Report to pacer that we have seen this many words allocated
if (ShenandoahPacing && (allocs_seen > 0)) {
_heap->pacer()->report_alloc(allocs_seen);
}
}

// If the cycle was cancelled, continue the next iteration to deal with it. Otherwise,
Expand All @@ -90,7 +80,7 @@ void ShenandoahGenerationalControlThread::run_service() {
MonitorLocker ml(&_control_lock, Mutex::_no_safepoint_check_flag);
if (_requested_gc_cause == GCCause::_no_gc) {
set_gc_mode(ml, none);
ml.wait(wait_ms);
ml.wait();
}
}
}
Expand Down Expand Up @@ -309,11 +299,6 @@ void ShenandoahGenerationalControlThread::run_gc_cycle(const ShenandoahGCRequest
// Print Metaspace change following GC (if logging is enabled).
MetaspaceUtils::print_metaspace_change(meta_sizes);

// GC is over, we are at idle now
if (ShenandoahPacing) {
_heap->pacer()->setup_for_idle();
}

// Check if we have seen a new target for soft max heap size or if a gc was requested.
// Either of these conditions will attempt to uncommit regions.
if (ShenandoahUncommit) {
Expand All @@ -331,9 +316,6 @@ void ShenandoahGenerationalControlThread::run_gc_cycle(const ShenandoahGCRequest
void ShenandoahGenerationalControlThread::process_phase_timings() const {
// Commit worker statistics to cycle data
_heap->phase_timings()->flush_par_workers_to_cycle();
if (ShenandoahPacing) {
_heap->pacer()->flush_stats_to_cycle();
}

ShenandoahEvacuationTracker* evac_tracker = _heap->evac_tracker();
ShenandoahCycleStats evac_stats = evac_tracker->flush_cycle_to_global();
Expand All @@ -347,9 +329,6 @@ void ShenandoahGenerationalControlThread::process_phase_timings() const {
_heap->phase_timings()->print_cycle_on(&ls);
evac_tracker->print_evacuations_on(&ls, &evac_stats.workers,
&evac_stats.mutators);
if (ShenandoahPacing) {
_heap->pacer()->print_cycle_on(&ls);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahOldGeneration.hpp"
#include "gc/shenandoah/shenandoahPacer.hpp"
#include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
#include "gc/shenandoah/shenandoahUtils.hpp"
#include "gc/shenandoah/shenandoahYoungGeneration.hpp"
Expand Down Expand Up @@ -127,9 +126,6 @@ void ShenandoahGenerationalEvacuationTask::evacuate_and_promote_regions() {
if (r->is_cset()) {
assert(r->has_live(), "Region %zu should have been reclaimed early", r->index());
_heap->marked_object_iterate(r, &cl);
if (ShenandoahPacing) {
_heap->pacer()->report_evac(r->used() >> LogHeapWordSize);
}
} else {
maybe_promote_region(r);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask {
region_progress = true;
}
// Otherwise, this is an old region in a young or mixed cycle. Process it during a second phase, below.
// Don't bother to report pacing progress in this case.
} else {
// Because updating of references runs concurrently, it is possible that a FREE inactive region transitions
// to a non-free active region while this loop is executing. Whenever this happens, the changing of a region's
Expand All @@ -857,10 +856,6 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask {
}
}

if (region_progress && ShenandoahPacing) {
_heap->pacer()->report_update_refs(pointer_delta(update_watermark, r->bottom()));
}

if (_heap->check_cancelled_gc_and_yield(CONCURRENT)) {
return;
}
Expand Down Expand Up @@ -916,10 +911,6 @@ class ShenandoahGenerationalUpdateHeapRefsTask : public WorkerTask {
assert(clusters * cluster_size == assignment._chunk_size, "Chunk assignment must align on cluster boundaries");
scanner->process_region_slice(r, assignment._chunk_offset, clusters, end_of_range, &cl, true, worker_id);
}

if (ShenandoahPacing) {
_heap->pacer()->report_update_refs(pointer_delta(end_of_range, start_of_range));
}
}
}
}
Expand Down
Loading