RFR: 8354452: Shenandoah: Enforce range checks on parameters controlling heuristic sleep times
Y. Srinivas Ramakrishna
ysr at openjdk.org
Fri Apr 11 21:12:25 UTC 2025
On Fri, 11 Apr 2025 21:03:59 GMT, William Kemper <wkemper at openjdk.org> wrote:
>> src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp line 1:
>>
>>> 1: /*
>>
>> Change looks fine, but I wonder about using a `naked_sleep()` and allowing longer durations without triggering asserts in those cases? Not sure where this could be used and whether 1-second is the maximum we might like for these numbers regardless.
>
> 1 second is enforced by `naked_sleep` itself, so raising it would impact all callers. Not using `naked_sleep` would be possible here, but the default maximum sleep time is 10ms. Even 1 second (well, 999ms) would make the heuristics dangerously slow to respond.
Hmm, curious, I see this:
// Convenience wrapper around naked_short_sleep to allow for longer sleep
// times. Only for use by non-JavaThreads.
void os::naked_sleep(jlong millis) {
assert(!Thread::current()->is_Java_thread(), "not for use by JavaThreads");
const jlong limit = 999;
while (millis > limit) {
naked_short_sleep(limit);
millis -= limit;
}
naked_short_sleep(millis);
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24602#discussion_r2040297668
More information about the shenandoah-dev
mailing list