Skip to content

(0.46.0) Changes to the code cache repository allocation code #19575

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

Merged
merged 2 commits into from
May 29, 2024

Conversation

mpirvu
Copy link
Contributor

@mpirvu mpirvu commented May 29, 2024

In order to eliminate helper trampolines, OpenJ9 tries to allocate the code cache in the vicinity of the JIT dll. This intention is signalled by using a preferredStartAddress when calling allocateCodeCacheSegment(). Currently, only x86-64 uses this approach.
This commit implements the following changes:

  • For Linux, we increase the search space to almost 2GB. Also, we prefer to start with an approach that uses the smaps pseudofile to find memory ranges where the code cache could be allocated.
  • For Windows, we keep a smaller memory search space because smaps are not available to speed up the search process.
  • We compute a preferred alignment and pass that to the VM. For x86-64 this alignment is 2 MB, i.e. the size of large pages used by the Transparent Huge Page (THP) mechanism. The alignment is relevant only when preferredStartAddress is provided.
  • For Linux we provide a hint to the OS (with madvise) that we prefer the usage of THP for the span of the code cache repository.

mpirvu added 2 commits May 29, 2024 09:25
In order to eliminate helper trampolines, OpenJ9 tries
to allocate the code cache in the vicinity of the JIT dll.
This intention is signalled by using a `preferredStartAddress`
when calling `allocateCodeCacheSegment()`. Currently, only
x86-64 uses this approach.
This commit implements the following changes:
- For Linux, we increase the search space to almost 2GB. Also,
we prefer to start with an approach that uses the `smaps`
pseudofile to find memory ranges where the code cache could be
allocated.
- For Windows, we keep a smaller memory search space because
smaps are not available to speed up the search process.
- We compute a preferred alignment and pass that to the VM.
For x86-64 this alignment is 2 MB, i.e. the size of large pages
used by the Transparent Huge Page (THP) mechanism. The alignment
is relevant only when preferredStartAddress is provided.
- For Linux we provide a hint to the OS (with madvise) that we
prefer the usage of THP for the span of the code cache repository.

Signed-off-by: Marius Pirvu <[email protected]>
@mpirvu mpirvu requested a review from dsouzai as a code owner May 29, 2024 16:29
@mpirvu
Copy link
Contributor Author

mpirvu commented May 29, 2024

This is a cherry-pick of two commits from the master branch:
99cabef
0f578fb

Copy link
Contributor

@dsouzai dsouzai left a comment

Choose a reason for hiding this comment

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

patches are identical

@dsouzai dsouzai merged commit a856f92 into eclipse-openj9:v0.46.0-release May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants