RFR: 8071277: G1: Merge commits and uncommits of contiguous memory [v2]

Thomas Schatzl tschatzl at openjdk.org
Fri Sep 26 11:46:28 UTC 2025


> Hi all,
> 
>   please review this change to G1 commit/uncommit to merge commit/uncommit calls to the operating system as much as possible. This significantly improves startup performanc
> 
> Performance results before/after on Zen3 processor for a "HelloWorld" application:
> 
> 
>  $ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
> Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
>   Time (mean ± σ): 16.4 ms ± 0.4 ms [User: 11.0 ms, System: 14.4 ms]
>   Range (min … max): 15.7 ms … 16.8 ms 10 runs
> 
> $ hyperfine -w 10 -r 10 "baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
> Benchmark 1: baseline/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
>   Time (mean ± σ): 24.7 ms ± 0.4 ms [User: 10.7 ms, System: 22.7 ms]
>   Range (min … max): 24.2 ms … 25.4 ms 10 runs
> 
> My reimplementation of JDK-8071277 does show improvements here:
> 
> $ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello"
> Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms128m -Xmx128m Hello
>   Time (mean ± σ): 15.9 ms ± 0.4 ms [User: 11.9 ms, System: 13.1 ms]
>   Range (min … max): 15.4 ms … 16.7 ms 10 runs
> 
> $ hyperfine -w 10 -r 10 "changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello"
> Benchmark 1: changes/bin/java -XX:+UseG1GC -Xms2g -Xmx2g Hello
>   Time (mean ± σ): 19.7 ms ± 0.3 ms [User: 11.3 ms, System: 17.4 ms]
>   Range (min … max): 19.2 ms … 20.1 ms 10 runs
> 
> 
> I.e., depending on actually committed heap size (`-Xms`), reduction of startup time by 20% or so in above cases.
> 
> Testing: tier1-5, gha
> 
> Thanks,
>   Thomas

Thomas Schatzl has updated the pull request incrementally with two additional commits since the last revision:

 - * exploit the fact that this is always a single region to (un-)commit
 - * ayang idea to use an iterative approach for better readability

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27381/files
  - new: https://git.openjdk.org/jdk/pull/27381/files/30248277..779daa7f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27381&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27381&range=00-01

  Stats: 109 lines in 1 file changed: 24 ins; 56 del; 29 mod
  Patch: https://git.openjdk.org/jdk/pull/27381.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27381/head:pull/27381

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


More information about the hotspot-gc-dev mailing list