Skip to content

8360817: [ubsan] zDirector select_worker_threads - outside the range of representable values issue #26186

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 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion src/hotspot/share/gc/z/zDirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,12 @@ static ZWorkerCounts select_worker_threads(const ZDirectorStats& stats, uint you
return {active_young_workers, active_old_workers};
}

const double young_to_old_ratio = calculate_young_to_old_worker_ratio(stats);
double young_to_old_ratio = calculate_young_to_old_worker_ratio(stats);
// limit young_to_old_ratio to the maximum clamping range value to avoid
// very high out of uint-range values in multiplication below
if (young_to_old_ratio > ZOldGCThreads) {
young_to_old_ratio = ZOldGCThreads;
}
uint old_workers = clamp(uint(young_workers * young_to_old_ratio), 1u, ZOldGCThreads);

if (type != ZWorkerSelectionType::normal && old_workers + young_workers > ConcGCThreads) {
Expand Down