RFR: Force termination logic is inverted

Zhengyu Gu zgu at redhat.com
Tue Oct 16 15:17:31 UTC 2018



On 10/16/2018 11:10 AM, Aleksey Shipilev wrote:
> On 10/16/2018 04:47 PM, Zhengyu Gu wrote:
>> When should_force_termination() returns true, termination should be terminated even there are
>> remaining tasks. Current logic does the opposite, it jumps right back for stealing works, e.g.
>> returning false.
>> Which means, it actually drains task queues, instead of leaving tasks there for degen cycle.
>>
>> Weberev: http://cr.openjdk.java.net/~zgu/shenandoah/force_termination/webrev.00/
> 
> Ugh. That condition is really hard to understand, no surprises there are bugs. It took me several
> minutes to grasp it. I finally convinced myself it is correct by rewriting it into:
> 
>      bool force = (terminator != NULL) && terminator->should_force_termination();
>      bool exit  = (terminator != NULL) && terminator->should_exit_termination();
>      if ((!force && peek_in_queue_set()) || exit) {
>        _offered_termination --;
>        _blocker->unlock();
>        return false;
>      }
> 
> Consider doing this instead?
Yep, I will take this.

Thanks,

-Zhengyu

> 
> Thanks,
> -Aleksey
> 
> 
> 


More information about the shenandoah-dev mailing list