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-8324598: use mem_unit when working with sysinfo memory and swap related information #17550

Closed
wants to merge 2 commits into from

Conversation

MBaesken
Copy link
Member

@MBaesken MBaesken commented Jan 24, 2024

According to the sysinfo manpage ( https://man7.org/linux/man-pages/man2/sysinfo.2.html ) the memory and swap related entries in the struct sysinfo are given as multiples of mem_unit bytes.
"In the above structure, sizes of the memory and swap fields are given as multiples of mem_unit bytes."

This is considered in most parts of the OpenJDK codebase when sysinfo is used but not all; should be added where it is missing.


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-8324598: use mem_unit when working with sysinfo memory and swap related information (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17550

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 24, 2024

👋 Welcome back mbaesken! 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 added the rfr Pull request is ready for review label Jan 24, 2024
@openjdk
Copy link

openjdk bot commented Jan 24, 2024

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

  • core-libs
  • hotspot-runtime

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-runtime hotspot-runtime-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Jan 24, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 24, 2024

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora 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.

Minor nit with lack of parentheses.

Thanks

@@ -417,7 +417,7 @@ pid_t os::Linux::gettid() {
julong os::Linux::host_swap() {
struct sysinfo si;
sysinfo(&si);
return (julong)si.totalswap;
return (julong)si.totalswap * si.mem_unit;
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: `(julong)(si.totalswap * si.mem_unit);

@@ -54,5 +54,5 @@ Java_jdk_internal_platform_CgroupMetrics_getTotalSwapSize0
if (retval < 0) {
return 0; // syinfo failed, treat as no swap
}
return (jlong)si.totalswap;
return (jlong)si.totalswap * si.mem_unit;
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: `(julong)(si.totalswap * si.mem_unit);

@openjdk
Copy link

openjdk bot commented Jan 25, 2024

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

8324598: use mem_unit when working with sysinfo memory and swap related information

Reviewed-by: dholmes, mdoerr

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

  • 6d36eb7: 8322768: Optimize non-subword vector compress and expand APIs for AVX2 target.
  • 9d1a6d1: 8323645: Remove unused internal sun.net.www.protocol.jar.URLJarFileCallBack interface
  • 3059c3b: 8324242: Avoid null check for OopHandle::ptr_raw()
  • 929af9e: 8307788: vmTestbase/gc/gctests/LargeObjects/large003/TestDescription.java timed out
  • e7fdac9: 8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode
  • 3d32c46: 6503196: API doc for DecimalFormat::getMaximumIntegerDigits is unclear
  • 2d5cb97: 8324647: Invalid test group of lib-test after JDK-8323515
  • 6212264: 8320692: Null icon returned for .exe without custom icon
  • 32eb529: 8324553: Shenandoah: Move periodic tasks closer to their collaborators
  • c702dca: 8323815: Source launcher should find classes with $ in names
  • ... and 8 more: https://git.openjdk.org/jdk/compare/6d2f6408e417b267be0345f63656f232cf247b6d...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 Jan 25, 2024
@MBaesken
Copy link
Member Author

Thanks for the review! I followed your suggestions regarding parenthesis.

Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

I would have preferred the original version, but it's ok either way.

@MBaesken
Copy link
Member Author

Hi Martin, thanks for the review !

/integrate

@openjdk
Copy link

openjdk bot commented Jan 25, 2024

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

  • 6d36eb7: 8322768: Optimize non-subword vector compress and expand APIs for AVX2 target.
  • 9d1a6d1: 8323645: Remove unused internal sun.net.www.protocol.jar.URLJarFileCallBack interface
  • 3059c3b: 8324242: Avoid null check for OopHandle::ptr_raw()
  • 929af9e: 8307788: vmTestbase/gc/gctests/LargeObjects/large003/TestDescription.java timed out
  • e7fdac9: 8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode
  • 3d32c46: 6503196: API doc for DecimalFormat::getMaximumIntegerDigits is unclear
  • 2d5cb97: 8324647: Invalid test group of lib-test after JDK-8323515
  • 6212264: 8320692: Null icon returned for .exe without custom icon
  • 32eb529: 8324553: Shenandoah: Move periodic tasks closer to their collaborators
  • c702dca: 8323815: Source launcher should find classes with $ in names
  • ... and 8 more: https://git.openjdk.org/jdk/compare/6d2f6408e417b267be0345f63656f232cf247b6d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 25, 2024

@MBaesken Pushed as commit 7a798d3.

💡 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
core-libs core-libs-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants