Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8313782: Add user-facing warning if THPs are enabled but cannot be used #15158

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Aug 4, 2023

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, 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@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@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)

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8313782: Add user-facing warning if THPs are enabled but cannot be used (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15158/head:pull/15158
$ git checkout pull/15158

Update a local copy of the PR:
$ git checkout pull/15158
$ git pull https://git.openjdk.org/jdk.git pull/15158/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15158

View PR using the GUI difftool:
$ git pr show -t 15158

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15158.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 4, 2023

👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

UseLargePages = UseTransparentHugePages = UseHugeTLBFS = UseSHM = false;
return;
}
if (!UseTransparentHugePages && HugePages::supports_static_hugepages() == false) {
warn_no_large_pages_configured();
Copy link
Member Author

@tstuefe tstuefe Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer note: warn_no_large_pages_configured() is the warning for static hugepage errors, so of no use for THPs.

@openjdk
Copy link

openjdk bot commented Aug 4, 2023

@tstuefe The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Aug 4, 2023
@tstuefe tstuefe marked this pull request as ready for review August 4, 2023 18:28
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 4, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 4, 2023

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seem okay. A couple of minor nits/requests.

Thanks

(!UseTransparentHugePages && HugePages::supports_static_hugepages() == false) ) {
// No large pages configured, return.
// 2) check if the OS supports THPs resp. static hugepages.
if (UseTransparentHugePages && HugePages::supports_thp() == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing nit: use !HugePages::supports_thp() rather than == false.

// 2) check if the OS supports THPs resp. static hugepages.
if (UseTransparentHugePages && HugePages::supports_thp() == false) {
if (!FLAG_IS_DEFAULT(UseTransparentHugePages)) {
log_warning(pagesize)("TransparentHugePages is not supported by the operating system.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

UseTransparentHugePages disabled, transparent huge pages are not supported by the operating system"

UseLargePages = UseTransparentHugePages = UseHugeTLBFS = UseSHM = false;
return;
}
if (!UseTransparentHugePages && HugePages::supports_static_hugepages() == false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto: use ! rather than == false.

@openjdk
Copy link

openjdk bot commented Aug 7, 2023

@tstuefe This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8313782: Add user-facing warning if THPs are enabled but cannot be used

Reviewed-by: dholmes, sjohanss

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 108 new commits pushed to the master branch:

  • f4e72c5: 8313949: Missing word in GPLv2 license text in StackMapTableAttribute.java
  • 6338927: 8314197: AttachListener::pd_find_operation always returning nullptr
  • b7dee21: 8314244: Incorrect file headers in new tests from JDK-8312597
  • 37c6b23: 8308340: C2: Idealize Fma nodes
  • 583cb75: 8313406: nep_invoker_blob can be simplified more
  • 0074b48: 8312597: Convert TraceTypeProfile to UL
  • 1f1c5c6: 8314241: Add test/jdk/sun/security/pkcs/pkcs7/SignerOrder.java to ProblemList
  • f142470: 8311981: Test gc/stringdedup/TestStringDeduplicationAgeThreshold.java#ZGenerational timed out
  • 595fdd3: 8314059: Remove PKCS7.verify()
  • 49b2984: 8313854: Some tests in serviceability area fail on localized Windows platform
  • ... and 98 more: https://git.openjdk.org/jdk/compare/e8a37b90db8dca4dc3653970b2d66d2faf8ef452...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 7, 2023
@tstuefe
Copy link
Member Author

tstuefe commented Aug 7, 2023

Seem okay. A couple of minor nits/requests.

Thanks

Thanks David; I worked in your feedback.

@tstuefe
Copy link
Member Author

tstuefe commented Aug 10, 2023

Ping. Could I have a second review please? Its rather trivial.

Copy link
Contributor

@kstefanj kstefanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@tstuefe
Copy link
Member Author

tstuefe commented Aug 15, 2023

Thanks @kstefanj and @dholmes-ora !

/integrate

@openjdk
Copy link

openjdk bot commented Aug 15, 2023

Going to push as commit dff99f7.
Since your change was applied there have been 108 commits pushed to the master branch:

  • f4e72c5: 8313949: Missing word in GPLv2 license text in StackMapTableAttribute.java
  • 6338927: 8314197: AttachListener::pd_find_operation always returning nullptr
  • b7dee21: 8314244: Incorrect file headers in new tests from JDK-8312597
  • 37c6b23: 8308340: C2: Idealize Fma nodes
  • 583cb75: 8313406: nep_invoker_blob can be simplified more
  • 0074b48: 8312597: Convert TraceTypeProfile to UL
  • 1f1c5c6: 8314241: Add test/jdk/sun/security/pkcs/pkcs7/SignerOrder.java to ProblemList
  • f142470: 8311981: Test gc/stringdedup/TestStringDeduplicationAgeThreshold.java#ZGenerational timed out
  • 595fdd3: 8314059: Remove PKCS7.verify()
  • 49b2984: 8313854: Some tests in serviceability area fail on localized Windows platform
  • ... and 98 more: https://git.openjdk.org/jdk/compare/e8a37b90db8dca4dc3653970b2d66d2faf8ef452...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Aug 15, 2023
@openjdk openjdk bot closed this Aug 15, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Aug 15, 2023
@openjdk
Copy link

openjdk bot commented Aug 15, 2023

@tstuefe Pushed as commit dff99f7.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants