RFR: 8224659: Parallel GC: Use WorkGang (1: PCRefProcTask)
Kim Barrett
kim.barrett at oracle.com
Tue May 28 17:26:02 UTC 2019
On May 27, 2019, at 1:18 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
>
>> On May 24, 2019, at 7:25 AM, Leo Korinth <leo.korinth at oracle.com> wrote:
>> […]
>> Enhancement:
>> https://bugs.openjdk.java.net/browse/JDK-8224659
>>
>> Webrev:
>> http://cr.openjdk.java.net/~lkorinth/workgang/0/_8224659-Parallel-GC-Use-WorkGang-1-PCRefProcTask/
>> http://cr.openjdk.java.net/~lkorinth/workgang/0/all/
>>
>> […]
>
> src/hotspot/share/gc/parallel/psParallelCompact.cpp
> 2108 do {
> 2109 while (ParCompactionManager::steal_objarray(worker_id, task)) {
> 2110 cm->follow_array((objArrayOop)task.obj(), task.index());
> 2111 cm->follow_marking_stacks();
> 2112 }
> 2113 while (ParCompactionManager::steal(worker_id, obj)) {
> 2114 cm->follow_contents(obj);
> 2115 cm->follow_marking_stacks();
> 2116 }
> 2117 } while (!terminator.offer_termination());
>
> This might offer termination earlier than it should, e.g. even if some
> objarrays have become available while other objects were being
> processed. Consider instead something like
>
> while (true) {
> if (ParCompactionManager::steal_objarray(worker_id, task)) {
> cm->follow_array((objArrayOop)task.obj(), task.index());
> cm->follow_marking_stacks();
> } else if (ParCompactionManager::steal(worker_id, obj)) {
> cm->follow_contents(obj);
> cm->follow_marking_stacks();
> } else if (terminator.offer_termination()) {
> break;
> }
> }
>
> or maybe make the second clause
>
> } else if (ParCompactionManager::steal(worker_id, obj)) {
> do {
> cm->follow_contents(obj);
> cm->follow_marking_stacks();
> } while (ParCompactionManager::steal(worker_id, obj)) {
> }
>
> to only check for arrays again when run out of normal objects (as done
> in the original proposed change).
Leo pointed out to me that the webrev code was cribbed from the pre-existing
StealMarkingTask::do_it(). So I’m okay with leaving the webrev code as-is, and
have asked Leo to create a followup RFE to look into changing this (and any
other similar places).
More information about the hotspot-gc-dev
mailing list