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

Aleksey Shipilev shade at openjdk.org
Wed Nov 29 13:04:15 UTC 2023


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:
 - [ ] Ad-hoc benchmarks
 - [ ] Linux x86_64 server fastdebug, `tier{1,2,3}` with `-XX:+UseParallelGC -XX:+AlwaysPreTouch`

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

Commit messages:
 - Work

Changes: https://git.openjdk.org/jdk/pull/16882/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16882&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8312023
  Stats: 14 lines in 1 file changed: 8 ins; 2 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/16882.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16882/head:pull/16882

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


More information about the hotspot-gc-dev mailing list