RFR: 8221785: Let possibly_parallel_threads_do cover the same threads as threads_do [v2]

Thomas Schatzl tschatzl at openjdk.org
Thu Jan 26 15:43:49 UTC 2023


> Hi all,
> 
>   can I have reviews for this change that makes `Threads::possibly_parallel_threads_do` iterate over the same set of threads as `threads_do` to have parity? I.e. over all java and non-java threads.
> 
> Originally this CR has been created to make a new method that keeps iterating only over java threads and the VM thread, but it's a bit weird to have both variants as the overhead of the extra threads is negligible and otherwise just confusing.
> 
> So I made `Threads::possibly_parallel_threads_do` iterate over all threads; all uses support that afaict, also all uses correctly change the claim token (mostly in the enclosing `StrongRootsScope`).
> 
> This allows some minimally better hiding of the token mechanism.
> 
> One other reason for not doing this in the first place (as in [JDK-8221102](https://bugs.openjdk.org/browse/JDK-8221102), or as discussed [here](https://mail.openjdk.org/pipermail/hotspot-dev/2019-April/037541.html)) has been the fear that there would be a problem with threads being created during iteration and the (common) call to 'Threads::assert_all_threads_claimed`. However all calls so far are during a safepoint, and none seem to create new threads. I suggest to defer looking at this problem when it is important.
> 
> Moreover I need that functionality is required for (JDK-8211104)[https://bugs.openjdk.org/browse/JDK-8211104]. :)
> 
> Testing: tier1-4, gha
> 
> Thanks,
>   Thomas

Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:

  coleenp review

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12201/files
  - new: https://git.openjdk.org/jdk/pull/12201/files/34e67f56..1d4458ff

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12201&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12201&range=00-01

  Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/12201.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12201/head:pull/12201

PR: https://git.openjdk.org/jdk/pull/12201


More information about the hotspot-gc-dev mailing list