Integrated: 8221785: Let possibly_parallel_threads_do cover the same threads as threads_do

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


On Wed, 25 Jan 2023 15:26:50 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: 315398c2
Author:    Thomas Schatzl <tschatzl at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/315398c2450e47d9cdb7fac944e35ba6a6aef221
Stats:     57 lines in 7 files changed: 18 ins; 8 del; 31 mod

8221785: Let possibly_parallel_threads_do cover the same threads as threads_do

Reviewed-by: iwalulya, coleenp

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

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


More information about the hotspot-gc-dev mailing list