RFR: 8221785: Let possibly_parallel_threads_do cover the same threads as threads_do
Thomas Schatzl
tschatzl at openjdk.org
Wed Jan 25 15:34:39 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
-------------
Commit messages:
- Replace existing manual claiming with possibly_parallel_threads_do calls
- initial version, just making possibly_parallel_threads_do cover the same threads as threads_do
Changes: https://git.openjdk.org/jdk/pull/12201/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12201&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8221785
Stats: 55 lines in 7 files changed: 16 ins; 8 del; 31 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 shenandoah-dev
mailing list