Skip to content

Commit 3e32985

Browse files
committed
8365317: ZGC: Setting ZYoungGCThreads lower than ZOldGCThreads may result in a crash
Reviewed-by: tschatzl, eosterlund
1 parent a6be228 commit 3e32985

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hotspot/share/gc/z/zDirector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ static ZWorkerCounts select_worker_threads(const ZDirectorStats& stats, uint you
725725
// Adjust down the old workers so the next minor during major will be less sad
726726
old_workers = old_workers_clamped;
727727
// Since collecting the old generation depends on the initial young collection
728-
// finishing, we don't want it to have fewer workers than the old generation.
729-
young_workers = MAX2(old_workers, young_workers);
728+
// finishing, we ideally don't want it to have fewer workers than the old generation.
729+
young_workers = clamp(MAX2(old_workers, young_workers), 1u, ZYoungGCThreads);
730730
} else if (type == ZWorkerSelectionType::minor_during_old) {
731731
// Adjust young and old workers for minor during old to fit within ConcGCThreads
732732
young_workers = young_workers_clamped;

0 commit comments

Comments
 (0)