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

8322484: 22-b26 Regression in J2dBench-bimg_misc-G1 (and more) on Windows-x64 and macOS-x64 #17552

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Jan 24, 2024

Hi all,

please review this improvement to managing region pin counts in g1.

Some applications do millions of Get/ReleasePrimitiveArrayCritical operations per second, in particular some of the j2dbench benchmarks (e.g. vimg_copyarea 10M/s), on some platforms. Every pin/unpin results in an atomic operation that is the cause for these slowdown.

Only Windows seems to be significantly affected.

This suggested change implements a per-region thread local cache storing the current pin/unpin refcount difference, writing it back only when a thread pins/unpin an object in a different region.

For these benchmarks this often reduces the amount of atomic operations to none, or a few handful; the worst improvement I have seen is that effective atomic operations were reduced to 1/10th. Overall all the j2dbench benchmark scores improve.

There is a remaining issue with the vimg_shapes_gradient J2dbench subbenchmark: comparing the original results (before integration of region pinning) with latest jdk23 results, there is a regression of about 5%; this is caused by the backout of a bad compiler change (https://bugs.openjdk.org/browse/JDK-8322985). This will be fixed by its redo CR https://bugs.openjdk.org/browse/JDK-8323116.

Testing: tier1-3, j2dbench, dacapo, specj*, renaissance benchmarks

Thanks,
Thomas


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-8322484: 22-b26 Regression in J2dBench-bimg_misc-G1 (and more) on Windows-x64 and macOS-x64 (Bug - P2)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17552

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

Using diff file

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

Webrev

Link to Webrev Comment

count atomic instructions executed

Refactoring

Fix -1 casting

refactoring, fix loosing pin counts on thread exit

refactoring, additional verification

fix compilation and issue with parameter evaluation ordering

Some more checking

Cleanup

missing comma in copyright

newline at end of file in g1RegionPinCache.cpp
@bridgekeeper
Copy link

bridgekeeper bot commented Jan 24, 2024

👋 Welcome back tschatzl! 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 8322484 8322484: 22-b26 Regression in J2dBench-bimg_misc-G1 (and more) on Windows-x64 and macOS-x64 Jan 24, 2024
@openjdk
Copy link

openjdk bot commented Jan 24, 2024

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

  • hotspot-gc

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-gc hotspot-gc-dev@openjdk.org label Jan 24, 2024
@tschatzl tschatzl marked this pull request as ready for review January 25, 2024 13:56
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 25, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 25, 2024

Webrevs

@tschatzl
Copy link
Contributor Author

The e1bb807 change passed tier1-7. (The removal of the assert in 4991abb won't invalidate that)

@openjdk
Copy link

openjdk bot commented Jan 26, 2024

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

8322484: 22-b26 Regression in J2dBench-bimg_misc-G1 (and more) on Windows-x64 and macOS-x64

Reviewed-by: kbarrett, ayang

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 40 new commits pushed to 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 openjdk bot added the ready Pull request is ready to be integrated label Jan 26, 2024
Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

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

One minor nit in comment. Otherwise looks good.

src/hotspot/share/gc/g1/g1RegionPinCache.hpp Outdated Show resolved Hide resolved
@tschatzl
Copy link
Contributor Author

Thanks @albertnetymk @kimbarrett for your reviews
/integrate

@openjdk
Copy link

openjdk bot commented Jan 29, 2024

Going to push as commit 0d5f5e1.
Since your change was applied there have been 40 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 29, 2024

@tschatzl Pushed as commit 0d5f5e1.

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

@tschatzl tschatzl deleted the submit/8322484-j2dbench-regression-final branch January 29, 2024 08:56
@tschatzl
Copy link
Contributor Author

/backport jdk22

@openjdk
Copy link

openjdk bot commented Jan 29, 2024

@tschatzl the backport was successfully created on the branch backport-tschatzl-0d5f5e15 in my personal fork of openjdk/jdk22. To create a pull request with this backport targeting openjdk/jdk22:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 0d5f5e15 from the openjdk/jdk repository.

The commit being backported was authored by Thomas Schatzl on 29 Jan 2024 and was reviewed by Kim Barrett and Albert Mingkun Yang.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22:

$ git fetch https://github.com/openjdk-bots/jdk22.git backport-tschatzl-0d5f5e15:backport-tschatzl-0d5f5e15
$ git checkout backport-tschatzl-0d5f5e15
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22.git backport-tschatzl-0d5f5e15

⚠️ @tschatzl You are not yet a collaborator in my fork openjdk-bots/jdk22. An invite will be sent out and you need to accept it before you can proceed.

@tschatzl
Copy link
Contributor Author

/backport jdk22u

@openjdk
Copy link

openjdk bot commented Jan 30, 2024

@tschatzl the backport was successfully created on the branch backport-tschatzl-0d5f5e15 in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 0d5f5e15 from the openjdk/jdk repository.

The commit being backported was authored by Thomas Schatzl on 29 Jan 2024 and was reviewed by Kim Barrett and Albert Mingkun Yang.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22u:

$ git fetch https://github.com/openjdk-bots/jdk22u.git backport-tschatzl-0d5f5e15:backport-tschatzl-0d5f5e15
$ git checkout backport-tschatzl-0d5f5e15
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22u.git backport-tschatzl-0d5f5e15

⚠️ @tschatzl You are not yet a collaborator in my fork openjdk-bots/jdk22u. An invite will be sent out and you need to accept it before you can proceed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants