RFR: Force termination logic is inverted
Aleksey Shipilev
shade at redhat.com
Tue Oct 16 15:10:38 UTC 2018
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?
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list