Skip to content

Conversation

@sercher
Copy link
Contributor

@sercher sercher commented Nov 14, 2025

Hi all,

Please review the backport of JDK-8313319 that prevents unnecessary mmap-munmap cycle in systems that do not honor the address hint when mmapping memory without MAP_FIXED. Please see more details in #2475. This is (almost) a clean backport, with only a minor context conflict due to JDK-8315923 hasn't been backported to JDK 21.

UPD: Apart from a minor context issue related to JDK-8315923, there was a second definition of MAP_FIXED_NOREPLACE, introduced by JDK-8330520 backport.

Testing:

  • jtreg standard test groups passed
  • gtests passed (aarch64 & amd64)

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
  • JDK-8313319 needs maintainer approval

Issue

  • JDK-8313319: [linux] mmap should use MAP_FIXED_NOREPLACE if available (Enhancement - P4 - Requested)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2476/head:pull/2476
$ git checkout pull/2476

Update a local copy of the PR:
$ git checkout pull/2476
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2476/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2476

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2476.diff

Using Webrev

Link to Webrev Comment

Backport-of: 3699666c9325b38d287e1d4d2576f8e3a662ae81
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 14, 2025

👋 Welcome back schernyshev! 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 Nov 14, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport 3699666c9325b38d287e1d4d2576f8e3a662ae81 8313319: [linux] mmap should use MAP_FIXED_NOREPLACE if available Nov 14, 2025
@openjdk
Copy link

openjdk bot commented Nov 14, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Nov 14, 2025
@openjdk
Copy link

openjdk bot commented Nov 14, 2025

⚠️ @sercher This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 14, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 14, 2025

Webrevs

@sercher
Copy link
Contributor Author

sercher commented Nov 16, 2025

/approval request Clean backport, use MAP_FIXED_NOREPLACE flag when supported by kernel, this prevents unnecessary mmap-munmap cycle in systems that do not honor the address hint in mmap() system call.

@openjdk
Copy link

openjdk bot commented Nov 16, 2025

@sercher
8313319: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Nov 16, 2025
@tstuefe
Copy link
Member

tstuefe commented Nov 17, 2025

Just to be clear, this downport's intent is performance, not outright failures, right?

I only know of two cases where we rely on fixed addressing, ZGC being one of them. The other would be class space reservation on Arm64. Do you see any other problems with the rand kernel patch outside of ZGC?

@sercher
Copy link
Contributor Author

sercher commented Nov 17, 2025

Hi Thomas, thanks four your note! Yes, this backport is performance only. I haven't seen other problems of randmmap-patched kernel except for one with ZGC.

UPD. I missed the double definition of MAP_FIXED_NOREPLACE that came from JDK-8330520.

@openjdk openjdk bot removed the clean Identical backport; no merge resolution required label Nov 17, 2025
@tstuefe
Copy link
Member

tstuefe commented Nov 18, 2025

Hmm

Hi Thomas, thanks four your note! Yes, this backport is performance only. I haven't seen other problems of randmmap-patched kernel except for one with ZGC.

UPD. I missed the double definition of MAP_FIXED_NOREPLACE that came from JDK-8330520.

Hmm. Something must have gone wrong with the backport of JDK-8330520. It took parts of 8313319 with it, it seems.

Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

Patch is okay.

@sercher
Copy link
Contributor Author

sercher commented Nov 18, 2025

Hmm. Something must have gone wrong with the backport of JDK-8330520. It took parts of 8313319 with it, it seems.

Exactly. It was spotted in the review and passed nevertheless

@sercher
Copy link
Contributor Author

sercher commented Nov 18, 2025

Patch is okay.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants