Skip to content

Commit dcf0b23

Browse files
author
William Kemper
committed
8365571: GenShen: PLAB promotions may remain disabled for evacuation threads
Backport-of: 08db4b99622e488558dd7987c34f1c515fa30426
1 parent 87538c5 commit dcf0b23

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ bool ShenandoahConcurrentGC::has_in_place_promotions(ShenandoahHeap* heap) {
832832
return heap->mode()->is_generational() && heap->old_generation()->has_in_place_promotions();
833833
}
834834

835-
template<bool GENERATIONAL>
836835
class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
837836
private:
838837
OopClosure* const _oops;
@@ -842,13 +841,9 @@ class ShenandoahConcurrentEvacThreadClosure : public ThreadClosure {
842841
void do_thread(Thread* thread) override {
843842
JavaThread* const jt = JavaThread::cast(thread);
844843
StackWatermarkSet::finish_processing(jt, _oops, StackWatermarkKind::gc);
845-
if (GENERATIONAL) {
846-
ShenandoahThreadLocalData::enable_plab_promotions(thread);
847-
}
848844
}
849845
};
850846

851-
template<bool GENERATIONAL>
852847
class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
853848
private:
854849
ShenandoahJavaThreadsIterator _java_threads;
@@ -860,30 +855,20 @@ class ShenandoahConcurrentEvacUpdateThreadTask : public WorkerTask {
860855
}
861856

862857
void work(uint worker_id) override {
863-
if (GENERATIONAL) {
864-
Thread* worker_thread = Thread::current();
865-
ShenandoahThreadLocalData::enable_plab_promotions(worker_thread);
866-
}
867-
868858
// ShenandoahEvacOOMScope has to be setup by ShenandoahContextEvacuateUpdateRootsClosure.
869859
// Otherwise, may deadlock with watermark lock
870860
ShenandoahContextEvacuateUpdateRootsClosure oops_cl;
871-
ShenandoahConcurrentEvacThreadClosure<GENERATIONAL> thr_cl(&oops_cl);
861+
ShenandoahConcurrentEvacThreadClosure thr_cl(&oops_cl);
872862
_java_threads.threads_do(&thr_cl, worker_id);
873863
}
874864
};
875865

876866
void ShenandoahConcurrentGC::op_thread_roots() {
877-
ShenandoahHeap* const heap = ShenandoahHeap::heap();
867+
const ShenandoahHeap* const heap = ShenandoahHeap::heap();
878868
assert(heap->is_evacuation_in_progress(), "Checked by caller");
879869
ShenandoahGCWorkerPhase worker_phase(ShenandoahPhaseTimings::conc_thread_roots);
880-
if (heap->mode()->is_generational()) {
881-
ShenandoahConcurrentEvacUpdateThreadTask<true> task(heap->workers()->active_workers());
882-
heap->workers()->run_task(&task);
883-
} else {
884-
ShenandoahConcurrentEvacUpdateThreadTask<false> task(heap->workers()->active_workers());
885-
heap->workers()->run_task(&task);
886-
}
870+
ShenandoahConcurrentEvacUpdateThreadTask task(heap->workers()->active_workers());
871+
heap->workers()->run_task(&task);
887872
}
888873

889874
void ShenandoahConcurrentGC::op_weak_refs() {

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,11 @@ class ShenandoahRetireGCLABClosure : public ThreadClosure {
12111211
// 1. We need to make the plab memory parsable by remembered-set scanning.
12121212
// 2. We need to establish a trustworthy UpdateWaterMark value within each old-gen heap region
12131213
ShenandoahGenerationalHeap::heap()->retire_plab(plab, thread);
1214+
1215+
// Re-enable promotions for the next evacuation phase.
1216+
ShenandoahThreadLocalData::enable_plab_promotions(thread);
1217+
1218+
// Reset the fill size for next evacuation phase.
12141219
if (_resize && ShenandoahThreadLocalData::plab_size(thread) > 0) {
12151220
ShenandoahThreadLocalData::set_plab_size(thread, 0);
12161221
}

0 commit comments

Comments
 (0)