RFR: Use os::naked_short_sleep instead of naked Thread events for sleeping
Aleksey Shipilev
shade at redhat.com
Wed Mar 7 10:35:14 UTC 2018
On 03/07/2018 11:26 AM, Roman Kennke wrote:
> In some cases I actually question why we are waiting at all, and don't
> we want to SpinPause() instead? E.g:
SpinPause is for very short busy-waits. We cannot afford busy-waiting on most of those paths.
>> // 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? ^^
Fixed with ShenandoahControlLoopInterval.
>> @@ -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).
It does exist. It does not exist with your OOM-during-evac changes.
>> 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?
It waits for concurrent thread to react on cancellation, mostly for logging purposes.
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list