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-8310107: os::trace_page_sizes_for_requested_size should name alignment as requested page size #14484

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Jun 15, 2023

Somewhat trivial renaming patch.

os::trace_page_sizes_for_requested_size() names "alignment" what is actually the requested page size. Historically, the distinction between "alignment" and "page size" in memory reservation code has not been clear. We often use "alignment" where we mean "page size". OTOH, ReservedSpace constructor takes a "preferred page size" argument, which it then uses as both alignment request and pagesize request, meaning that even if it fails to get the desired page size it attempts to satisfy the alignment.

Clearing this up would be a larger effort. Here, I propose to rename "alignment" to "requested page size" in os::trace_page_sizes_for_requested_size() since it clearer conveys the difference between requested and actual page size, which is the important bit for pagesize logging.


Patch renames "alignment" to "requested pagesize" in printout and code.

It also reshuffles the parameters somewhat to have requested properties at the beginning, followed by the actual properties of the region.

Printout before, for a failed 2M paged allocation. Notice the difference between requested and actual page size, the latter being labeled as "alignment"):

OpenJDK 64-Bit Server VM warning: Failed to reserve and commit memory using large pages. req_addr: 0x0000000000000000 bytes: 2097152
[0.012s][info][pagesize] Block Offset Table: req_size=2M base=0x00007f3518200000 page_size=4K alignment=2M size=2M

Printout now:

OpenJDK 64-Bit Server VM warning: Failed to reserve and commit memory using large pages. req_addr: 0x0000000000000000 bytes: 2097152
[0.011s][info][pagesize] Block Offset Table: req_size=2M req_page_size=2M base=0x00007fda0e400000 size=2M page_size=4K

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-8310107: os::trace_page_sizes_for_requested_size should name alignment as requested page size (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14484

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 15, 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.

@openjdk
Copy link

openjdk bot commented Jun 15, 2023

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

  • hotspot

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 hotspot-dev@openjdk.org label Jun 15, 2023
@tstuefe tstuefe marked this pull request as ready for review June 15, 2023 14:07
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 15, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 15, 2023

Webrevs

@tstuefe
Copy link
Member Author

tstuefe commented Jun 15, 2023

x86 error unrelated.

Copy link
Member

@stefank stefank left a comment

Choose a reason for hiding this comment

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

I think this looks reasonable and we should also change os::trace_page_sizes to have the same order when printing base, size, and page_size.

@tstuefe
Copy link
Member Author

tstuefe commented Jun 16, 2023

I think this looks reasonable and we should also change os::trace_page_sizes to have the same order when printing base, size, and page_size.

Thank you, @stefank . New version changes printing- and argument order of os::trace_page_sizes to equal os::trace_page_sizes_for_requested_size().

While checking the affected tests, I noticed that gc/g1/TestLargePageUseForAuxMemory.java is broken when running on machines with 1G pages configured. Opened a separate issue https://bugs.openjdk.org/browse/JDK-8310216 to track that.

Copy link
Member

@stefank stefank 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. One nit:

@@ -405,19 +405,19 @@ class os: AllStatic {
// passed to page_size_for_region() and page_size should be the result of that
// call. The (optional) base and size parameters should come from the
// ReservedSpace base() and size() methods.
static void trace_page_sizes(const char* str, const size_t* page_sizes, int count);
// static void trace_page_sizes(const char* str, const size_t* page_sizes, int count);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be removed?

@openjdk
Copy link

openjdk bot commented Jun 16, 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:

8310107: os::trace_page_sizes_for_requested_size should name alignment as requested page size

Reviewed-by: stefank, dholmes

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 41 new commits pushed to the master branch:

  • 02aaab1: 8310126: C1: Missing receiver null check in Reference::get intrinsic
  • 492d25c: 8309601: [JVMCI] AMD64#getLargestStorableKind returns incorrect mask kind
  • 959a61f: 8310259: Pin msys2/setup-msys2 github action to a specific commit
  • bcc4d36: 8309511: Regression test ExtraImportSemicolon.java refers to the wrong bug
  • 71baf00: 8309605: StubRoutines are not used by SA
  • 16134f4: 8310211: serviceability/jvmti/thread/GetStackTrace/getstacktr03/getstacktr03.java failing
  • d6c2ee3: 8310054: ScrollPane insets are incorrect
  • 4eb4f20: 8308808: SunMSCAPI public keys returns internal key array
  • 53abba3: 8309499: javac fails to report compiler.err.no.java.lang with annotation processing enabled
  • cf8d0b0: 8309964: Use directed inheritDoc for javax.lang.model API
  • ... and 31 more: https://git.openjdk.org/jdk/compare/181845ae46157a9bb3bf8e2a328fa59eddc0273a...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 Jun 16, 2023
@tstuefe
Copy link
Member Author

tstuefe commented Jun 16, 2023

Looks good. One nit:

Thank you!

I removed a leftover prototype that had no caller nor implementation. Also a last test fix.

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.

Functional changes seem fine. I don't know the tests so can't comment on those other than the seemingly unrelated change to print the summary.

Thanks.

@@ -126,6 +126,8 @@ static void testVM(String what, long heapsize, boolean cardsShouldUseLargePages,
pb = ProcessTools.createJavaProcessBuilder(getOpts(heapsize, true));

OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.reportDiagnosticSummary();
Copy link
Member

Choose a reason for hiding this comment

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

This should come last as if any output.shouldxxx() fails then the summary will be printed anyway, so we don't need to see it twice.

@tstuefe
Copy link
Member Author

tstuefe commented Jun 19, 2023

Functional changes seem fine. I don't know the tests so can't comment on those other than the seemingly unrelated change to print the summary.

Thanks.

Thank you David. I removed the debug output.

@tstuefe
Copy link
Member Author

tstuefe commented Jun 19, 2023

x86-errors in GHA unrelated.

/integrate

@openjdk
Copy link

openjdk bot commented Jun 19, 2023

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

  • 02aaab1: 8310126: C1: Missing receiver null check in Reference::get intrinsic
  • 492d25c: 8309601: [JVMCI] AMD64#getLargestStorableKind returns incorrect mask kind
  • 959a61f: 8310259: Pin msys2/setup-msys2 github action to a specific commit
  • bcc4d36: 8309511: Regression test ExtraImportSemicolon.java refers to the wrong bug
  • 71baf00: 8309605: StubRoutines are not used by SA
  • 16134f4: 8310211: serviceability/jvmti/thread/GetStackTrace/getstacktr03/getstacktr03.java failing
  • d6c2ee3: 8310054: ScrollPane insets are incorrect
  • 4eb4f20: 8308808: SunMSCAPI public keys returns internal key array
  • 53abba3: 8309499: javac fails to report compiler.err.no.java.lang with annotation processing enabled
  • cf8d0b0: 8309964: Use directed inheritDoc for javax.lang.model API
  • ... and 31 more: https://git.openjdk.org/jdk/compare/181845ae46157a9bb3bf8e2a328fa59eddc0273a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 19, 2023

@tstuefe Pushed as commit 6473a7d.

💡 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 hotspot-dev@openjdk.org integrated Pull request has been integrated
3 participants