RFR: JDK-8313782: Add user-facing warning if THPs are enabled but cannot be used
David Holmes
dholmes at openjdk.org
Mon Aug 7 07:55:31 UTC 2023
On Fri, 4 Aug 2023 14:27:39 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> We don't warn the user if `+UseTransparentHugePages ` were specified (and nothing else, but this implies `+UseLargePages`), but the system does not support THPs.
>
> We used to have warnings in the code, but I checked and they never really worked (I tried older versions of the JDK). The reason is that THP detection had been broken. The broken detection always reported success even if THPs are disabled, so the user would never have seen this warning even when we had it.
>
> THP detection has since been fixed with [JDK-8310233](https://bugs.openjdk.org/browse/JDK-8310233), but we still don't warn.
>
> The patch re-introduces the warning, with the same text as it used to have, and using the warning level of UL with the "pagesize" tag - that's what we do for static hugepage warnings too.
>
> Before:
>
> thomas at starfish$ ./images/jdk/bin/java -XX:+UseTransparentHugePages -version
> openjdk version "20-ea" 2023-03-21
> OpenJDK Runtime Environment SapMachine (build 20-ea+32)
> OpenJDK 64-Bit Server VM SapMachine (build 20-ea+32, mixed mode, sharing)
>
>
> Now:
>
> thomas at starfish$ ./images/jdk/bin/java -XX:+UseTransparentHugePages -version
> [0.001s][warning][pagesize] TransparentHugePages is not supported by the operating system.
> openjdk version "22-internal" 2024-03-19
> OpenJDK Runtime Environment (fastdebug build 22-internal-adhoc.thomas.source)
> OpenJDK 64-Bit Server VM (fastdebug build 22-internal-adhoc.thomas.source, mixed mode, sharing)
Seem okay. A couple of minor nits/requests.
Thanks
src/hotspot/os/linux/os_linux.cpp line 3797:
> 3795:
> 3796: // 2) check if the OS supports THPs resp. static hugepages.
> 3797: if (UseTransparentHugePages && HugePages::supports_thp() == false) {
Pre-existing nit: use `!HugePages::supports_thp()` rather than `== false`.
src/hotspot/os/linux/os_linux.cpp line 3799:
> 3797: if (UseTransparentHugePages && HugePages::supports_thp() == false) {
> 3798: if (!FLAG_IS_DEFAULT(UseTransparentHugePages)) {
> 3799: log_warning(pagesize)("TransparentHugePages is not supported by the operating system.");
Suggestion:
UseTransparentHugePages disabled, transparent huge pages are not supported by the operating system"
src/hotspot/os/linux/os_linux.cpp line 3804:
> 3802: return;
> 3803: }
> 3804: if (!UseTransparentHugePages && HugePages::supports_static_hugepages() == false) {
Ditto: use ! rather than `== false`.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15158#pullrequestreview-1564657724
PR Review Comment: https://git.openjdk.org/jdk/pull/15158#discussion_r1285445673
PR Review Comment: https://git.openjdk.org/jdk/pull/15158#discussion_r1285451720
PR Review Comment: https://git.openjdk.org/jdk/pull/15158#discussion_r1285452208
More information about the hotspot-runtime-dev
mailing list