RFR: 8265842: G1: Introduce API to run multiple separate tasks in a single gangtask [v5]

Leo Korinth lkorinth at openjdk.java.net
Tue Apr 27 11:58:44 UTC 2021


On Tue, 27 Apr 2021 09:39:08 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> [JDK-8214237](https://bugs.openjdk.java.net/browse/JDK-8214237) is going to join different somewhat independent (sub-)tasks of the post evacuation phase into basically two gangtasks to improve performance (reduce startup and shutdown of work gangs).
>> 
>> To facilitate doing that, introduce an API that manages subtasks of a given gangtask and provide some helpers to do common work.
>> 
>> This CR is only about adding the API and testing to somewhat simplify the actual move of the post evacuate tasks into parallel tasks. There is no new functionality here, only to split up [JDK-8214237](https://bugs.openjdk.java.net/browse/JDK-8214237) a bit.
>> 
>> [Here](https://github.com/openjdk/jdk/compare/master...tschatzl:parallel-phases-join-everything) is the full change that uses this API to implement JDK-8214237 (which I'll try to split up a bit before) to see how it will be used (in [G1YoungGCPostEvacuateTasks.hpp](https://github.com/openjdk/jdk/commit/1d8667143e7d106b96c25c0b876c37f1250be132#diff-64bc43a24e11978920bb9523cb1507a7275ace22d9eead4c34177339a3258e42) ).
>> 
>> Testing: new gtest, tier1-5 with mentioned patch for JDK-8214237.
>> 
>> Thanks,
>> Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix whitespace once more

Looks good to me.

src/hotspot/share/gc/g1/g1BatchedGangTask.hpp line 35:

> 33: class GrowableArrayCHeap;
> 34: 
> 35: // G1AbstractSubTask represents a task to be performed either within an

within an -> within a

src/hotspot/share/gc/g1/g1BatchedGangTask.hpp line 66:

> 64:   // as long as to amortize worker startup costs.
> 65:   // Called by G1BatchedGangTask to determine total number of workers.
> 66:   virtual double num_busy_workers() const { return 1.0; }

maybe make pure virtual?

src/hotspot/share/gc/g1/g1BatchedGangTask.hpp line 86:

> 84: // of "serial" or the list of "parallel" tasks.
> 85: // During execution in the work gang, this class will make sure that the "serial"
> 86: // tasks are executed by a single worker only exactly once, but different "serial"

worker only exactly once -> worker exactly once

src/hotspot/share/gc/g1/g1BatchedGangTask.hpp line 89:

> 87: // tasks may be executed in parallel using different workers. "Parallel" tasks'
> 88: // do_work() method may be called by different workers passing a different
> 89: // worker_id at the same time, but at most once per given worker id.

worker id -> worker_id (I hope to one day rename worker_id to work_id, work_unit, or something else, but if we are not referring to the variable, we should not describe it as a worker id, as it does not describe a worker but a unit of work.

-------------

Marked as reviewed by lkorinth (Committer).

PR: https://git.openjdk.java.net/jdk/pull/3653



More information about the hotspot-gc-dev mailing list