Skip to content

Conversation

@jerboaa
Copy link
Contributor

@jerboaa jerboaa commented May 3, 2024

Please review this preparatory PR which is an enabler for some bugfix/alignment work (e.g. JDK-8322420). The idea is to delegate limit lookup to controllers (memory, cpu, etc.) from the overarching CgroupSubsystem class. This way we can - once the cg type has been detected - "adjust" a controller's path to the limit files when the controller is being created (on init) and then left alone. In this case, the two preparatory entry points are CgroupUtil::processor_count() taking a version-agnostic CgroupCpuController to do the actual look-up and CgroupMemoryController::read_memory_limit_in_bytes() for the same in terms of memory limits.

This enables setting the contoller's path to the interface files (wherever it might be in the hierarchy of it's original cgroup path), look up the limit and "freeze" the path once it found a - lower - limit.

It also ensures that both cgroup versions return -1 or -2 (OSCONTAINER_ERROR) - in both cases negative - for some notion of unlimited. I.e. it makes the upper bound by the host's physical memory apparent in the version agnostic classes.

Testing:

  • GHA
  • gtest:cgroupTest tests
  • container tests on Linux cgv1 and cgv2 on x86_64

Thoughts?


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-8331560: Refactor Hotspot container detection code so that subsystem delegates to controllers (Enhancement - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19085

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 3, 2024

👋 Welcome back sgehwolf! A progress list of the required criteria for merging this PR into pr/19060 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 May 3, 2024

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

8331560: Refactor Hotspot container detection code so that subsystem delegates to controllers

Reviewed-by: jsjolen, stuefe

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

  • dd74e7f: 8335147: Serial: Refactor TenuredGeneration::promote
  • a537e87: 8335530: Java file extension missing in AuthenticatorTest
  • 4060b35: 8335298: Fix -Wzero-as-null-pointer-constant warning in G1CardSetContainers
  • 9046d7a: 8335390: C2 MergeStores: wrong result with Unsafe
  • 318d9ac: 8335369: Fix -Wzero-as-null-pointer-constant warnings in ImmutableOopMapBuilder
  • 5fe07b3: 5021949: JSplitPane setEnabled(false) shouldn't be partially functional
  • ee4720a: 8333306: gc/arguments/TestParallelGCErgo.java fails when largepage are enabled
  • 2f4f6cc: 8317721: RISC-V: Implement CRC32 intrinsic
  • 3ca2bcd: 8335060: ClassCastException after JDK-8294960
  • 747e1e4: 8334295: CTW: update modules

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented May 3, 2024

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

  • hotspot-runtime

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.

@jerboaa jerboaa marked this pull request as ready for review May 6, 2024 08:31
@openjdk openjdk bot added the rfr Pull request is ready for review label May 6, 2024
@mlbridge
Copy link

mlbridge bot commented May 6, 2024

Webrevs

jerboaa added 8 commits May 15, 2024 18:27
Hybrid MACRO usage and locked down reading primitives.
It only reads the swap value, thus doesn't print:
"Memory and Swap Limit is" but rather prints:
"Swap Limit is". This is fine, since for cg v2
the memory limit and the swap limits are in different
files.
@openjdk
Copy link

openjdk bot commented May 21, 2024

@jerboaa this pull request can not be integrated into pr/19060 due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout jdk-8331560-cgroup-controller-delegation
git fetch https://git.openjdk.org/jdk.git pr/19060
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge pr/19060"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label May 21, 2024
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label May 21, 2024
@jankratochvil
Copy link
Contributor

There is the diamond inheritance problem. I am providing a patch, it would be too much clicking in the Github review.
diamond.patch.txt

Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

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

Hi,

Some more review work here. Unfortunately, mostly nits. I'll take a more big-picture look next.

@jerboaa
Copy link
Contributor Author

jerboaa commented Jun 19, 2024

Thanks for the review. Updated the patch!

Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

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

Hi! Some more review comments.

@jerboaa
Copy link
Contributor Author

jerboaa commented Jun 26, 2024

Updated the patch with your suggestions. Thanks!

@openjdk openjdk bot removed the rfr Pull request is ready for review label Jul 1, 2024
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.

This has been shaping up nicely. From my point of view, this is good to go. Leave it up to @jdksjolen to add any more suggestions.

@jerboaa
Copy link
Contributor Author

jerboaa commented Jul 2, 2024

Thanks for the review, Thomas!

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 2, 2024
Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

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

I went through it again, LGTM. Nice!

@jerboaa
Copy link
Contributor Author

jerboaa commented Jul 2, 2024

Thanks for the reviews!

@jerboaa
Copy link
Contributor Author

jerboaa commented Jul 2, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Jul 2, 2024

Going to push as commit 153b12b.
Since your change was applied there have been 11 commits pushed to the master branch:

  • 685e587: 8334816: compiler/c2/irTests/TestIfMinMax.java fails after 8334629
  • dd74e7f: 8335147: Serial: Refactor TenuredGeneration::promote
  • a537e87: 8335530: Java file extension missing in AuthenticatorTest
  • 4060b35: 8335298: Fix -Wzero-as-null-pointer-constant warning in G1CardSetContainers
  • 9046d7a: 8335390: C2 MergeStores: wrong result with Unsafe
  • 318d9ac: 8335369: Fix -Wzero-as-null-pointer-constant warnings in ImmutableOopMapBuilder
  • 5fe07b3: 5021949: JSplitPane setEnabled(false) shouldn't be partially functional
  • ee4720a: 8333306: gc/arguments/TestParallelGCErgo.java fails when largepage are enabled
  • 2f4f6cc: 8317721: RISC-V: Implement CRC32 intrinsic
  • 3ca2bcd: 8335060: ClassCastException after JDK-8294960
  • ... and 1 more: https://git.openjdk.org/jdk/compare/0a6ffa57954ddf4f92205205a5a1bada813d127a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 2, 2024

@jerboaa Pushed as commit 153b12b.

💡 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-runtime [email protected] integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants