RFR: 8306738: Select num workers for safepoint ParallelCleanupTask [v3]
Aleksey Shipilev
shade at openjdk.org
Fri May 5 17:15:15 UTC 2023
On Wed, 3 May 2023 14:34:16 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Select num workers for safepoint ParallelCleanupTask to be at most the number of parallel cleanup tasks `SAFEPOINT_CLEANUP_NUM_TASKS`
>>
>> Unsure if `WorkerThreads::max_workers()` is more correct than `WorkerThreads::created_workers()` or `WorkerThreads::active_workers()`.
>>
>> Tested tier1-3 Oracle platforms.
>
> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
>
> Add expected_num_workers
This looks very promising to me, but I have a few readability suggestions.
src/hotspot/share/classfile/stringTable.cpp line 538:
> 536: }
> 537:
> 538: uint StringTable::rehash_table_expected_workers() {
We always reply either `0` or `1` from these. So logically, it seems to answer whether we need heavy work. So, this method is then simpler, and matching the structure of the relevant `rehash_table`:
// Quick checks if we would do any heavy-weight safepoint work in rehash_table.
// Add shortcut cases here when changing rehash_table.
bool StringTable::needs_safepoint_rehash_table() {
// Grow instead of rehash
if (should_grow()) return false;
// Already rehashed
if (_rehashed) return false;
// Should and can do alt-rehashing
if (!_needs_rehashing) return false;
if (!_local_table->is_safepoint_safe()) return false;
return true;
}
-------------
PR Review: https://git.openjdk.org/jdk/pull/13616#pullrequestreview-1415141703
PR Review Comment: https://git.openjdk.org/jdk/pull/13616#discussion_r1186316929
More information about the hotspot-runtime-dev
mailing list