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

Thomas Schatzl tschatzl at openjdk.org
Fri Feb 2 07:30:02 UTC 2024


On Fri, 2 Feb 2024 03:37:21 GMT, Wang Zhuo <wzhuo at openjdk.org> wrote:

>> 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 test as review comment

Please fix the typo I did not find last time before integrating.

Lgtm.

test/hotspot/jtreg/gc/parallel/TestAlwaysPreTouchBehavior.java line 54:

> 52:     public static long getProcessRssInKb() throws IOException {
> 53:         String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
> 54:         // Read RSS from /proc/$pid/status. Only avaiable on Linux

Suggestion:

        // Read RSS from /proc/$pid/status. Only available on Linux.

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

Marked as reviewed by tschatzl (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17610#pullrequestreview-1858552804
PR Review Comment: https://git.openjdk.org/jdk/pull/17610#discussion_r1475663679


More information about the hotspot-gc-dev mailing list