RFR: 8324817: Parallel GC does not pre-touch all heap pages when AlwaysPreTouch enabled and large page disabled
Wang Zhuo
wzhuo at openjdk.org
Mon Jan 29 08:49:49 UTC 2024
AlwaysPreTouch requires all freshly committed pages to be pre-touched. While currently PS GC does not pre-touch heap pages with -XX:+AlwaysPreTouch.
It is related to [JDK-8315923](https://bugs.openjdk.org/browse/JDK-8315923), which fixes the issue when huge pages are used. But the bug still stands if regular page are used. On linux we can reproduce this bug when /sys/kernel/mm/transparent_hugepage/enabled is madvise or never, but cannot reproduce when it is always.
A simple way to reproduce, please make sure large pages are NOT used.
Just run a test with the following parameters
-XX:+AlwaysPreTouch -Xms31g -Xmx31g -XX:+UseParallelGC
There is no pre-touching during heap initialing stage. After initialization, RSS of the test process is much smaller than memory committed.
On the contrary, using -XX:+UseG1GC and run the test again
-XX:+AlwaysPreTouch -Xms31g -Xmx31g -XX:+UseG1GC
it takes several seconds to pre-touch heap pages during initialization, and RSS usage after initialization is similar to memory committed. This is the expected behavior of AlwaysPreTouch
This issue related to [JDK-8283935](https://bugs.openjdk.org/browse/JDK-8283935), which uses alignment() instead of os::vm_page_size() as pre-touching step size. The value of alignment() is usually bigger than OS page size, which causes most heap pages are not pre-touched.
-------------
Commit messages:
- remove tabs
- 8324817: Parallel GC does not pre-touch heap pages when AlwaysPreTouch enabled/large page disabled
Changes: https://git.openjdk.org/jdk/pull/17610/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17610&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8324817
Stats: 100 lines in 2 files changed: 98 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/17610.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17610/head:pull/17610
PR: https://git.openjdk.org/jdk/pull/17610
More information about the hotspot-gc-dev
mailing list