RFR: 8312023: Parallel pretouch should shortcut when only 1 thread is needed [v2]

Thomas Schatzl tschatzl at openjdk.org
Thu Nov 30 15:48:05 UTC 2023


On Wed, 29 Nov 2023 20:16:31 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> This is a follow-up for code introduced in JDK 16 by [JDK-8252221](https://bugs.openjdk.org/browse/JDK-8252221). 
>> 
>> Unfortunately, we do pre-touch not only at startup, but also during the application lifetime when space boundary moves, see [JDK-8312021](https://bugs.openjdk.org/browse/JDK-8312021). From that code, we start the pre-touch threads unconditionally, even when we only need one thread anyway. This is clearly visible with `-Xlog:gc+heap=debug`. The actual pretouch takes single-digit microseconds, but the round-trip through the worker pool incurs latency of about 100us (2x 50us) in my setups. This is significant for very short GC pauses.
>> 
>> Additional testing:
>>  - [x] Ad-hoc benchmarks
>>  - [x] Linux x86_64 server fastdebug, `tier{1,2,3}` with `-XX:+UseParallelGC -XX:+AlwaysPreTouch`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Restore calculation, hoping to fix Windows build

Marked as reviewed by tschatzl (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/16882#pullrequestreview-1757782295


More information about the hotspot-gc-dev mailing list