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

Wang Zhuo wzhuo at openjdk.org
Tue Jan 30 09:31:42 UTC 2024


On Mon, 29 Jan 2024 13:13:40 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> > 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.
> 
> Could you explain why this bug is affected by that OS config flag? As you pointed out, `alignment()` (is `GenAlignment` as I read the code) can be different from `os::vm_page_size()`, so pretouching uses the wrong page-size. However, I don't get how `transparent_hugepage` is related here.
> 
> A semi-related issue, if `alignment()` can have the wrong page-size, does it mean `numa_setup_pages` (a few lines above) also needs revision?

This bug is affected by that OS config flag because [JDK-8315923](https://bugs.openjdk.org/browse/JDK-8315923) added check for the config flag, and set page_size to os::vm_page_size() when the flag is always. But page_size is still alignment() when the flag is madivise or never.
Please check src/hotspot/os/linux/os_linux.cpp os::pd_pretouch_memory. In this function if HugePages::thp_mode() equals THPMode::always, page_size is set to os::vm_page_size();

For numa_setup_pages, because numa_setup_pages sets memory for from/to/eden regions, I think alignment() is sufficient here. There is some discussion about page size in numa_setup_pages here, please check. https://github.com/openjdk/jdk/pull/8090

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

PR Comment: https://git.openjdk.org/jdk/pull/17610#issuecomment-1916416878


More information about the hotspot-gc-dev mailing list