Skip to content

Conversation

@dlunde
Copy link
Member

@dlunde dlunde commented Oct 26, 2023

This changeset fixes an issue where certain large values of -XX:NMethodSizeLimit could cause code heap initialization to fail with the error message

Error occurred during initialization of VM
Could not reserve enough space in CodeHeap 'profiled nmethods' (0K)

Two components in CodeCache::initialize_heaps may cause the error:

  1. The minimum size (min_size = os::vm_page_size();) for profiled and non-profiled code heaps is sometimes not large enough. Specifically, when profiled_size and/or non_profiled_size are set to min_size and alignment > os::vm_page_size(), the align_down below (from CodeCache::initialize_heaps) sets the size to 0.
    const size_t alignment = MAX2(ps, os::vm_allocation_granularity());
    non_nmethod_size = align_up(non_nmethod_size, alignment);
    profiled_size    = align_down(profiled_size, alignment);
    non_profiled_size = align_down(non_profiled_size, alignment);
    
  2. The calculation for default code heap sizes does not consider the edge case when cache_size > non_nmethod_size > cache_size - 2 * min_size.

This changeset

  1. ensures that min_size >= alignment, and
  2. fixes the edge case.

The changeset includes new tests that exercise the above, also in combination with -XX:+UseTransparentHugePages on Linux to test the case when os::can_execute_large_page_memory() is true (which can affect alignment).

Testing (on all Oracle-supported platforms)

tier1, tier2, tier3, tier4, tier5


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-8318817: Could not reserve enough space in CodeHeap 'profiled nmethods' (0K) (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16373

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 26, 2023

👋 Welcome back dlunde! 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 openjdk bot changed the title 8318817 8318817: Could not reserve enough space in CodeHeap 'profiled nmethods' (0K) Oct 26, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 26, 2023
@openjdk
Copy link

openjdk bot commented Oct 26, 2023

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

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label Oct 26, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 26, 2023

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.

Some comments, otherwise good.

Copy link
Contributor

@robcasloz robcasloz 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, but should also be reviewed by someone with more experience in this area. @tstuefe, since you already looked at this, would you be willing to review?

@openjdk
Copy link

openjdk bot commented Nov 6, 2023

@dlunde 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:

8318817: Could not reserve enough space in CodeHeap 'profiled nmethods' (0K)

Reviewed-by: stuefe, rcastanedalo

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

  • 07eaea8: 8303920: Avoid calling out to python in DataDescriptorSignatureMissing test
  • fe0ccdf: 8319640: ClassicFormat::parseObject (from DateTimeFormatter) does not conform to the javadoc and may leak DateTimeException
  • 1802cb5: 8319570: Change to GCC 13.2.0 for building on Linux at Oracle
  • d992033: 8317562: [JFR] Compilation queue statistics
  • 965ae72: 8319753: Duration javadoc has "period" instead of "duration" in several places
  • 115b074: 8319944: Remove DynamicDumpSharedSpaces
  • c0507af: 8319818: Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer)
  • 3684b4b: 8306116: Update CLDR to Version 44.0
  • 88ccd64: 8296250: Update ICU4J to Version 74.1

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@tstuefe, @robcasloz) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 6, 2023
Copy link
Contributor

@robcasloz robcasloz left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my suggestion!

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.

Okay. Please add the comment as indicated; I don't need another review.

..Thomas

@dlunde
Copy link
Member Author

dlunde commented Nov 13, 2023

All comments addressed now and I've also rerun tier1-tier5 tests.

@dlunde
Copy link
Member Author

dlunde commented Nov 13, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 13, 2023
@openjdk
Copy link

openjdk bot commented Nov 13, 2023

@dlunde
Your change (at version 7e40f25) is now ready to be sponsored by a Committer.

@robcasloz
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Nov 14, 2023

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

  • 07eaea8: 8303920: Avoid calling out to python in DataDescriptorSignatureMissing test
  • fe0ccdf: 8319640: ClassicFormat::parseObject (from DateTimeFormatter) does not conform to the javadoc and may leak DateTimeException
  • 1802cb5: 8319570: Change to GCC 13.2.0 for building on Linux at Oracle
  • d992033: 8317562: [JFR] Compilation queue statistics
  • 965ae72: 8319753: Duration javadoc has "period" instead of "duration" in several places
  • 115b074: 8319944: Remove DynamicDumpSharedSpaces
  • c0507af: 8319818: Address GCC 13.2.0 warnings (stringop-overflow and dangling-pointer)
  • 3684b4b: 8306116: Update CLDR to Version 44.0
  • 88ccd64: 8296250: Update ICU4J to Version 74.1

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 14, 2023

@robcasloz @dlunde Pushed as commit 7df73a2.

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

@dlunde
Copy link
Member Author

dlunde commented Nov 14, 2023

Okay. Please add the comment as indicated; I don't need another review.

..Thomas

Thanks for your help and review @tstuefe!

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

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants