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

8315219: G1: Improve allocator pathological case where it keeps doing direct allocations instead of retiring a PLAB #15482

Closed
wants to merge 6 commits into from

Conversation

walulyai
Copy link
Member

@walulyai walulyai commented Aug 30, 2023

Hi all,

Please review this change to improve on how G1 deals with ParallelGCBufferWastePct. Currently, any allocations larger than ParallelGCBufferWastePct of the current PLAB size are allocated directly without regard for the state of the current PLAB. This creates a pathological case where fully used up PLAB are not retired given that allocation sizes larger than ParallelGCBufferWastePct current PLAB.

In this change, we directly check whether the current PLAB can be retired i.e. the remaining PLAB space is < ParallelGCBufferWastePct of current PLAB size. This should reduce the number of direct allocations.

Testing: - mach5 Tier 1-6
- No regression was observed on perf benchmarks


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-8315219: G1: Improve allocator pathological case where it keeps doing direct allocations instead of retiring a PLAB (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15482

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2023

👋 Welcome back iwalulya! 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 Aug 30, 2023
@openjdk
Copy link

openjdk bot commented Aug 30, 2023

@walulyai 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 Aug 30, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 30, 2023

Webrevs

Copy link
Contributor

@tschatzl tschatzl left a comment

Choose a reason for hiding this comment

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

Apart from that casing issue, looks good.

@@ -62,17 +63,18 @@ public class TestPLABPromotion {
private final static String PLAB_DIRECT_ALLOCATED_FIELD_NAME = "direct allocated";
private final static List<String> FIELDS_TO_EXTRACT = Arrays.asList(PLAB_USED_FIELD_NAME, PLAB_DIRECT_ALLOCATED_FIELD_NAME);

public final static int heapWordSize = Platform.is32bit() ? 4 : 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to keep using the existing style for static finals.

@openjdk
Copy link

openjdk bot commented Aug 30, 2023

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

8315219: G1: Improve allocator pathological case where it keeps doing direct allocations instead of retiring a PLAB

Reviewed-by: tschatzl, ayang, mli

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

  • c90cd2c: 8286789: Test forceEarlyReturn002.java timed out
  • 89d18ea: 8312018: Improve reservation of class space and CDS
  • dd64a4a: 8315241: (fs) Move toRealPath tests in java/nio/file/Path/Misc.java to separate JUnit 5 test
  • 8e4cda0: 8314834: serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
  • 1ea6463: 8314835: gtest wrappers should be marked as flagless
  • 93e82c0: 8314824: Fix serviceability/jvmti/8036666/GetObjectLockCount.java to use vm flags
  • 7daae1f: 8314263: Signed jars triggering Logger finder recursion and StackOverflowError
  • 6701eba: 8315117: Update Zlib Data Compression Library to Version 1.3
  • e29f0c2: 8297777: Convert jdk.jlink StringSharingPlugin to use Class File API
  • bf63945: 8298992: runtime/NMT/SummarySanityCheck.java failed with "Total committed (MMMMMM) did not match the summarized committed (NNNNNN)"
  • ... and 2 more: https://git.openjdk.org/jdk/compare/ed1ea5fe7c6fad03ca96e7dece2127eab21a608a...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 Aug 30, 2023

PLAB* alloc_buf = alloc_buffer(dest, node_index);
guarantee(alloc_buf->words_remaining() <= required_in_plab, "must be");
guarantee(words_remaining <= required_in_plab, "must be");
Copy link
Member

Choose a reason for hiding this comment

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

What's the intend of this check? Also, if the two are equal, plab-alloc should have succeeded, so one shouldn't retire the current plab.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a (pre-existing) sanity check (that is correct but a little imprecise because in the == case we would not reach here) and could (and probably should because it is somewhat confusing) be removed.

Copy link

@Hamlin-Li Hamlin-Li left a comment

Choose a reason for hiding this comment

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

LGTM.

@walulyai
Copy link
Member Author

Thanks for reviews @albertnetymk , @Hamlin-Li, and @tschatzl.

/integrate

@openjdk
Copy link

openjdk bot commented Aug 31, 2023

Going to push as commit 47aa6f3.
Since your change was applied there have been 17 commits pushed to the master branch:

  • 218829e: 8315421: [BACKOUT] 8314834 serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
  • 3c8a667: 8314611: Provide more explicative error message parsing Currencies
  • df5e6e5: 8315248: AssertionError in Name.compareTo
  • 3eac890: 8315061: Make LockingMode a product flag
  • 8419a53: 8315072: Remove unneeded AdaptivePaddedAverage::operator new
  • c90cd2c: 8286789: Test forceEarlyReturn002.java timed out
  • 89d18ea: 8312018: Improve reservation of class space and CDS
  • dd64a4a: 8315241: (fs) Move toRealPath tests in java/nio/file/Path/Misc.java to separate JUnit 5 test
  • 8e4cda0: 8314834: serviceability/jdwp/AllModulesCommandTest.java ignores VM flags
  • 1ea6463: 8314835: gtest wrappers should be marked as flagless
  • ... and 7 more: https://git.openjdk.org/jdk/compare/ed1ea5fe7c6fad03ca96e7dece2127eab21a608a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 31, 2023

@walulyai Pushed as commit 47aa6f3.

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

Successfully merging this pull request may close these issues.

4 participants