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-8310388: Shenandoah: Auxiliary bitmap is not madvised for THP #14953

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Jul 20, 2023

See details in JBS isse.

Note that there is no actual functional difference. AUX bitmap did not use THPs before this patch and does not now either. The only difference is that before, the JVM thought the AUX bitmap uses THPs when in fact it did not. That caused confusion.

(All this illuminates how badly thought out the ReservedSpace API really is. We pass in page size to the constructor, but then need to commit manually; THPs actually use madvise on commit, not on reservation, so we need to pass page size in again to commit. Ideally, ReservedSpace should handle committing for us with the page size it saved from reservation.)

Note that this only takes care of preventing THP formation in "madvise" mode. In "always" mode, the kernel will do THP coalescation always. We could prevent it from doing so by advising against it via madvise, but that would require extension of the platform generic reservation APIs and is left for a different RFE. Ideally, nobody should use THP "always" mode.


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-8310388: Shenandoah: Auxiliary bitmap is not madvised for THP (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14953

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 20, 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 Jul 20, 2023

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

  • hotspot
  • shenandoah

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

@openjdk openjdk bot added hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Jul 20, 2023
@tstuefe tstuefe force-pushed the JDK-8310388-Shenandoah-Auxiliary-bitmap-is-not-madvised-for-THP branch 2 times, most recently from a527256 to ef02c1e Compare July 20, 2023 15:16
@tstuefe tstuefe force-pushed the JDK-8310388-Shenandoah-Auxiliary-bitmap-is-not-madvised-for-THP branch from ef02c1e to 03ff47b Compare July 20, 2023 15:17
@tstuefe tstuefe marked this pull request as ready for review July 20, 2023 15:19
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 20, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 20, 2023

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks fine.

Does it make sense to enable runtime/os/TestTracePageSizes.java now?

Comment on lines 284 to 287
// Note: on Linux, in THP "advise" mode, we refrain from advising the system to use large pages
// since we know these commits will be short lived.
const size_t aux_bitmap_page_size =
LINUX_ONLY(UseTransparentHugePages ? os::vm_page_size() :) bitmap_page_size;
Copy link
Member

@shipilev shipilev Jul 20, 2023

Choose a reason for hiding this comment

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

There is a ifdef LINUX THP-related block in the same file, so better to match its style:

   size_t aux_bitmap_page_size = bitmap_page_size;
#ifdef LINUX
   // In THP "advise" mode, we refrain from advising the system to use large pages
   // since we know these commits will be short lived, and there is no reason to trash
   // the THP area with this bitmap.
   if (UseTransparentHugePages) {
     aux_bitmap_page_size = os::vm_page_size();
   }
#endif 

@openjdk
Copy link

openjdk bot commented Jul 20, 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:

8310388: Shenandoah: Auxiliary bitmap is not madvised for THP

Reviewed-by: shade, kdnilsen

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

  • f66cd50: 8313564: Fix -Wconversion warnings in classfile code
  • e8a37b9: 8313248: C2: setScopedValueCache intrinsic exposes nullptr pre-values to store barriers
  • 29f1d8e: 8313707: GHA: Bootstrap sysroots with --variant=minbase
  • 61c58fd: 8312976: MatchResult produces StringIndexOutOfBoundsException for groups outside match
  • 5d23295: 8313251: Add NativeLibraryLoad event
  • c4b8574: 8311938: Add default cups include location for configure on AIX
  • 10a2605: 8294979: test/jdk/tools/jlink 3 test classes use ASM library
  • e8c325d: 8313394: Array Elements in OldObjectSample event has the incorrect description
  • d60352e: 8311006: missing @SInCE info in jdk.xml.dom
  • 4577147: 8313712: [BACKOUT] 8313632: ciEnv::dump_replay_data use fclose
  • ... and 145 more: https://git.openjdk.org/jdk/compare/32833285bf94a17989db9bdfa86f58777ab9187d...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 Jul 20, 2023
@tstuefe
Copy link
Member Author

tstuefe commented Jul 20, 2023

Looks fine.

Does it make sense to enable runtime/os/TestTracePageSizes.java now?

Maybe. Possibly. I just found another bug [1] in TestTracePageSizes where it does not correctly identify VMAs that are clearly backed by THPs, because it looks for the VM_xxx flags alone. I rather leave that test out for now to stabilize it a bit more; I don't want to start whacking the mole again.

[1] https://bugs.openjdk.org/browse/JDK-8312471

@tstuefe
Copy link
Member Author

tstuefe commented Aug 4, 2023

Friendly ping... still need a second review.

Copy link
Contributor

@kdnilsen kdnilsen 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 to me.

@tstuefe
Copy link
Member Author

tstuefe commented Aug 4, 2023

Thanks Kelvin!

/integrate

@openjdk
Copy link

openjdk bot commented Aug 4, 2023

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

  • f66cd50: 8313564: Fix -Wconversion warnings in classfile code
  • e8a37b9: 8313248: C2: setScopedValueCache intrinsic exposes nullptr pre-values to store barriers
  • 29f1d8e: 8313707: GHA: Bootstrap sysroots with --variant=minbase
  • 61c58fd: 8312976: MatchResult produces StringIndexOutOfBoundsException for groups outside match
  • 5d23295: 8313251: Add NativeLibraryLoad event
  • c4b8574: 8311938: Add default cups include location for configure on AIX
  • 10a2605: 8294979: test/jdk/tools/jlink 3 test classes use ASM library
  • e8c325d: 8313394: Array Elements in OldObjectSample event has the incorrect description
  • d60352e: 8311006: missing @SInCE info in jdk.xml.dom
  • 4577147: 8313712: [BACKOUT] 8313632: ciEnv::dump_replay_data use fclose
  • ... and 145 more: https://git.openjdk.org/jdk/compare/32833285bf94a17989db9bdfa86f58777ab9187d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 4, 2023

@tstuefe Pushed as commit 017e0c7.

💡 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 shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants