8310233: Fix THP detection on Linux#3171
Conversation
|
👋 Welcome back dtabata! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
This backport pull request has now been updated with issue from the original commit. |
|
This looks ok standalone, but I doubt the maintainers will approve it. First, it will need follow-up backports, which increases risk. Second, this is a P4 bug, and arguably an enhancement. Third, the 17u backport is 2.5 years old, so an unclean 11u backport will be deemed high risk for a release in maintenance mode. |
|
@tabata-d This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a |
|
/touch |
|
@tabata-d The pull request is being re-evaluated and the inactivity timeout has been reset. |
|
/template append |
|
@tabata-d The pull request template has been appended to the pull request body |
JDK-8310233 is a bug where the JDK 11 Hotspot VM on Linux incorrectly detects Transparent Huge Pages (THPs) status and page size. This leads to misconfigurations and inefficient memory usage.
The fix was originally implemented in JDK 22. Now we are backporting this into JDK 11.
I confirmed that it was reproduced on Linux x86_64 using JDK 11.
Unclean Backport
os::large_page_init()(with JDK-8256155): The JDK 22 code (in theelseblock for static huge pages) explicitly retrievesos::PageSizes all_large_pages = HugePages::static_info().pagesizes();. Thisall_large_pages(No longer used in JDK11) is a variable introduced in JDK 22 as part of JDK-8256155 , holds a comprehensive list of all large_page_sizes supported by the kernel not just the default. This allowed JDK 22 to intelligently select the most appropriate large page size (the largest available that is smaller than the bytes being reserved) based onLargePageSizeInBytesacting as a maximum allowed size. It then uses a complex conditional block to interpretLargePageSizeInBytesagainst this list and populates_page_sizeswith multiple large page sizes less than or equal to_large_page_size.os::large_page_init()(without JDK-8256155): The JDK 11 backport'selseblock for static huge pages is significantly simpler. It directly sets_large_page_sizetoHugePages::default_static_hugepage_size(). Theall_large_pagesvariable and the complex logic used in JDK22 that leverages it for flexible page size selection are not present and not used in the JDK 11 backport. Instead, it populates_page_sizesonly with the single configured static huge page size and the VM page size.Other Code Differences and Adaptations:
os_linux.cpp:size_t os::Linux::_default_large_page_size = 0;(present in JDK 22) was not performed in JDK 11 as this member was absent.int os::Linux::hugetlbfs_page_size_flag(size_t page_size)(done in JDK 22) was not performed in JDK 11 as the relevant code structure was different.static size_t scan_default_large_page_size(),static os::PageSizes scan_multiple_page_support(), andsize_t os::Linux::default_large_page_size(), the backport removed JDK 11's equivalent functions:size_t os::Linux::find_large_page_size()andsize_t os::Linux::setup_large_page_size().NULLinstead ofnullptr.os_linux.hpp:static size_t _default_large_page_size;(present in JDK 22) was not performed in JDK 11 as this declaration was absent.static size_t default_large_page_size();,static size_t scan_default_large_page_size();, andstatic os::PageSizes scan_multiple_page_support();, the backport removed JDK 11's equivalent declarations:static size_t find_large_page_size();andstatic size_t setup_large_page_size();.enuminstead ofenum class.HugePageConfiguration.java:Testing
System: Red Hat Enterprise Linux 9.4 (x86_64).
jtreg: A comprehensive
jtregrun on the entirehotspot/jtregtest suite confirmed that all HotSpot tests passed.Progress
Integration blocker
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3171/head:pull/3171$ git checkout pull/3171Update a local copy of the PR:
$ git checkout pull/3171$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3171/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3171View PR using the GUI difftool:
$ git pr show -t 3171Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3171.diff
Using Webrev
Link to Webrev Comment