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:08:04 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> 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);
> }
Still if ppl aren't gonna need longer than 1 sec, and longer is a bad idea, then limiting it is a good idea.
Reviewed. 🚢
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24602#discussion_r2040298962
More information about the shenandoah-dev
mailing list