RFR: 8307348 - Parallelize heap walk for ObjectCount(AfterGC) JFR event collection [v5]
Aleksey Shipilev
shade at openjdk.org
Fri May 5 12:18:20 UTC 2023
On Fri, 5 May 2023 11:46:28 GMT, olivergillespie <duke at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/gcVMOperations.cpp line 174:
>>
>>> 172: // Can't run with more threads than provided by the WorkerThreads.
>>> 173: const uint capped_parallel_thread_num = MIN2(_parallel_thread_num, workers->max_workers());
>>> 174: WithActiveWorkers with_active_workers(workers, capped_parallel_thread_num);
>>
>> `WithActiveWorkers` is an stack-obj, so it must be in the same scope as using workers.
>
> Oh, good catch. So can I do something like:
>
>
> HeapInspection inspect;
> if (workers != nullptr) {
> // The GC provided a WorkerThreads to be used during a safepoint.
> // Can't run with more threads than provided by the WorkerThreads.
> const uint capped_parallel_thread_num = MIN2(_parallel_thread_num, workers->max_workers());
> WithActiveWorkers with_active_workers(workers, capped_parallel_thread_num);
> inspect.heap_inspection(_out, workers);
> } else {
> inspect.heap_inspection(_out, nullptr);
> }
>
>
> ?
>
> (I'm not familiar with the exact workings of StackObj, sorry)
Yes, do that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13774#discussion_r1186020045
More information about the hotspot-gc-dev
mailing list