RFR: 8343153: compiler/codecache/CheckLargePages.java fails on linux with huge pages configured but its number set to 0 [v3]

Damon Fenacci dfenacci at openjdk.org
Fri Nov 1 12:14:06 UTC 2024


> # Issue
> 
> The third test of `compiler/codecache/CheckLargePages.java` checks that non-segmented 1GB code cache can be allocated with 1GB large pages.
> 
> On linux (the only supported platform) in order to allocate them, 1GB huge pages have to be enabled (checkable from `/proc/meminfo` and `/sys/kernel/mm/hugepages/hugepages-xxxx`) and their number has to be set to >0 (checkable from `/sys/kernel/mm/hugepages/hugepages-xxxx/nr_hugepages`).
> 
> If 1GB huge pages are enabled but their number is 0, the test fails because it looks for a string that matches `CodeCache: min=1[gG] max=1[gG] base=[^ ]+ size=1[gG] page_size=1[gG]` but the actual output is `CodeCache: min=1G max=1G base=0x00007f4040000000 size=1G page_size=2M`. This happens because the VM tries to allocate 1GB huge pages but it fails beause the number of allocatable ones is 0 and the VM reverts to smaller large page sizes (2MB).
> 
> # Solution
> 
> The problem might be attributed to the VM only checking for 1GB huge pages to be supported, not how many there currently are. Nevertheless, this seems to be the correct behaviour, not least because their number can be changed dynamically.
> So, the correct thing to do seems to be to "relax" the check made by the test to include both cases:
> * when 1GB huge pages are supported and can be allocated correctly
> * when 1GB huge pages are supported but cannot be allocated correctly (because there are none available) and the VM reverts to 2MB huge pages (if there are no 2MB pages available the test doesn't run at all).

Damon Fenacci has updated the pull request incrementally with three additional commits since the last revision:

 - JDK-8343153: add missing import
 - JDK-8343153: add missing brackets
 - JDK-8343153: add missing try-catch

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21757/files
  - new: https://git.openjdk.org/jdk/pull/21757/files/9670eef6..989ef945

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

  Stats: 6 lines in 1 file changed: 2 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/21757.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21757/head:pull/21757

PR: https://git.openjdk.org/jdk/pull/21757


More information about the hotspot-compiler-dev mailing list