RFR: Use os::naked_short_sleep instead of naked Thread events for sleeping
Roman Kennke
rkennke at redhat.com
Wed Mar 7 10:26:25 UTC 2018
Hi Aleksey,
that makes a lot of sense.
In some cases I actually question why we are waiting at all, and don't
we want to SpinPause() instead? E.g:
> // Wait for the actual stop(), can't leave run_service() earlier.
> while (!should_terminate()) {
> - Thread::current()->_ParkEvent->park(10);
> + os::naked_short_sleep(10);
> }
> }
And hardcoded 10ms? ^^
> @@ -444,7 +444,7 @@
> GCCause::to_string(GCCause::_shenandoah_allocation_failure_evac),
> Thread::current()->name());
> while (heap->is_evacuation_in_progress()) { // wait.
> - Thread::current()->_ParkEvent->park(1);
> + os::naked_short_sleep(1);
> }
> }
> }
This loop doesn't exist anymore (in dev repo).
> diff -r 58279d273cc4 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
> --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Mar 05 17:05:30 2018 +0100
> +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Wed Mar 07 11:13:54 2018 +0100
> @@ -2849,7 +2849,7 @@
> void ShenandoahHeap::try_inject_alloc_failure() {
> if (ShenandoahAllocFailureALot && !cancelled_concgc() && ((os::random() % 1000) > 950)) {
> _inject_alloc_failure.set();
> - Thread::current()->_ParkEvent->park(1);
> + os::naked_short_sleep(1);
> if (cancelled_concgc()) {
> log_info(gc)("Allocation failure was successfully injected");
> }
What is this waiting for?
Roman
More information about the shenandoah-dev
mailing list