RFR: 8324817: Parallel GC does not pre-touch all heap pages when AlwaysPreTouch enabled and large page disabled [v3]
Albert Mingkun Yang
ayang at openjdk.org
Wed Jan 31 10:21:02 UTC 2024
On Wed, 31 Jan 2024 03:57:59 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, adding some error message.
test/hotspot/jtreg/gc/parallel/TestAlwaysPreTouchBehavior.java line 92:
> 90: } else {
> 91: System.out.println("Passed RSS = " + rss + " committed memory " + committedMemory);
> 92: }
Why these branches/print here? Could these println be incorporated in the assert msg below?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17610#discussion_r1472604441
More information about the hotspot-gc-dev
mailing list