RFR: 8324817: Parallel GC does not pre-touch all heap pages when AlwaysPreTouch enabled and large page disabled [v2]

Wang Zhuo wzhuo at openjdk.org
Wed Jan 31 03:54:02 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.

Wang Zhuo has updated the pull request incrementally with one additional commit since the last revision:

  update the test. Baseline changed from 90%* committed memory to 100%

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/17610/files
  - new: https://git.openjdk.org/jdk/pull/17610/files/ad9cb229..cc6f08df

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

  Stats: 5 lines in 1 file changed: 0 ins; 1 del; 4 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