diff --git a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp index 8d10b7cbfcf..e7d5a2e00c5 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp @@ -253,9 +253,9 @@ void ShenandoahPacer::pace_for_alloc(size_t words) { return; } - jlong const max_delay = ShenandoahPacingMaxDelay * NANOSECS_PER_MILLISEC; - jlong const start_time = os::elapsed_counter(); - while (!claimed && (os::elapsed_counter() - start_time) < max_delay) { + jlong const start_time = os::javaTimeNanos(); + jlong const deadline = start_time + (ShenandoahPacingMaxDelay * NANOSECS_PER_MILLISEC); + while (!claimed && os::javaTimeNanos() < deadline) { // We could instead assist GC, but this would suffice for now. wait(1); claimed = claim_for_alloc(words); @@ -267,7 +267,7 @@ void ShenandoahPacer::pace_for_alloc(size_t words) { claimed = claim_for_alloc(words); assert(claimed, "Should always succeed"); } - ShenandoahThreadLocalData::add_paced_time(current, (double)(os::elapsed_counter() - start_time) / NANOSECS_PER_SEC); + ShenandoahThreadLocalData::add_paced_time(current, (double)(os::javaTimeNanos() - start_time) / NANOSECS_PER_SEC); } void ShenandoahPacer::wait(size_t time_ms) { @@ -276,7 +276,7 @@ void ShenandoahPacer::wait(size_t time_ms) { assert(time_ms > 0, "Should not call this with zero argument, as it would stall until notify"); assert(time_ms <= LONG_MAX, "Sanity"); MonitorLocker locker(_wait_monitor); - _wait_monitor->wait((long)time_ms); + _wait_monitor->wait(time_ms); } void ShenandoahPacer::notify_waiters() { diff --git a/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java b/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java index 00e32a4136e..1a3d07bf80d 100644 --- a/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java +++ b/test/hotspot/jtreg/gc/shenandoah/oom/TestClassLoaderLeak.java @@ -27,7 +27,7 @@ * @summary Test OOME in due to classloader leak * @requires vm.gc.Shenandoah * @library /test/lib - * @run driver/timeout=600 TestClassLoaderLeak + * @run driver TestClassLoaderLeak */ import java.util.*;