RFR(S) 8205921: Optimizing best-of-2 work stealing queue selection

Kim Barrett kim.barrett at oracle.com
Thu Jul 5 19:33:03 UTC 2018


> On Jul 5, 2018, at 3:16 PM, Zhengyu Gu <zgu at redhat.com> wrote:
> 
>>> Updated webrev:
>>> 
>>> http://cr.openjdk.java.net/~zgu/8205921/webrev.01/index.html
>> src/hotspot/share/gc/shared/taskqueue.inline.hpp
>>  255     if (sz2 > sz1) {
>>  256       sel_k = k2;
>>  257       suc = _queues[k2]->pop_global(t);
>>  258     } else {
>>  259       sel_k = k1;
>>  260       suc = _queues[k1]->pop_global(t);
>>  261     }
>> The paper avoids the steal attempt when both potential victims have a
>> size of zero, e.g. insert another clause:
>>   } else if (sz1 == 0) {
>>     sel_k = k1;  // Might be needed to avoid uninitialized variable warnings?
>>     suc = false;
>>   } else {
>>     ...
>> There is a race condition between obtaining the size and checking it
>> here, but I don't think that's important.  The point is to avoid an
>> expensive steal attempt when it is very likely to fail.
> 
> Yes, I missed this.
> 
> http://cr.openjdk.java.net/~zgu/8205921/webrev.02/index.html
> 
> Thanks,
> 
> -Zhengyu

I think that makes the change accurately reflect the paper.

Just one minor nit: extraneous whitespace in “0 )”:
 258     } else if (sz1 > 0 ) {





More information about the hotspot-gc-dev mailing list