8365571: GenShen: PLAB promotions may remain disabled for evacuation threads

Reviewed-by: kdnilsen, ysr, shade
This commit is contained in:
William Kemper 2025-08-15 17:56:47 +00:00
parent dbae90c950
commit 08db4b9962
2 changed files with 9 additions and 19 deletions

View File

@ -823,7 +823,6 @@ bool ShenandoahConcurrentGC::has_in_place_promotions(ShenandoahHeap* heap) {
return heap->mode()->is_generational() && heap->old_generation()->has_in_place_promotions();
}
template<bool GENERATIONAL>
class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
private:
OopClosure* const _oops;
@ -833,13 +832,9 @@ public:
void do_thread(Thread* thread) override {
JavaThread* const jt = JavaThread::cast(thread);
StackWatermarkSet::finish_processing(jt, _oops, StackWatermarkKind::gc);
if (GENERATIONAL) {
ShenandoahThreadLocalData::enable_plab_promotions(thread);
}
}
};
template<bool GENERATIONAL>
class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
private:
ShenandoahJavaThreadsIterator _java_threads;
@ -851,30 +846,20 @@ public:
}
void work(uint worker_id) override {
if (GENERATIONAL) {
Thread* worker_thread = Thread::current();
ShenandoahThreadLocalData::enable_plab_promotions(worker_thread);
}
// ShenandoahEvacOOMScope has to be setup by ShenandoahContextEvacuateUpdateRootsClosure.
// Otherwise, may deadlock with watermark lock
ShenandoahContextEvacuateUpdateRootsClosure oops_cl;
ShenandoahConcurrentEvacThreadClosure<GENERATIONAL> thr_cl(&oops_cl);
ShenandoahConcurrentEvacThreadClosure thr_cl(&oops_cl);
_java_threads.threads_do(&thr_cl, worker_id);
}
};
void ShenandoahConcurrentGC::op_thread_roots() {
ShenandoahHeap* const heap = ShenandoahHeap::heap();
const ShenandoahHeap* const heap = ShenandoahHeap::heap();
assert(heap->is_evacuation_in_progress(), "Checked by caller");
ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_thread_roots);
if (heap->mode()->is_generational()) {
ShenandoahConcurrentEvacUpdateThreadTask<true> task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
} else {
ShenandoahConcurrentEvacUpdateThreadTask<false> task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
}
ShenandoahConcurrentEvacUpdateThreadTask task(heap->workers()->active_workers());
heap->workers()->run_task(&task);
}
void ShenandoahConcurrentGC::op_weak_refs() {

View File

@ -1216,6 +1216,11 @@ public:
// 1. We need to make the plab memory parsable by remembered-set scanning.
// 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);
// Re-enable promotions for the next evacuation phase.
ShenandoahThreadLocalData::enable_plab_promotions(thread);
// Reset the fill size for next evacuation phase.
if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
ShenandoahThreadLocalData::set_plab_size(thread, 0);
}