Skip to content

8300447: Parallel: Refactor PSPromotionManager::drain_stacks_depth#12063

Closed
albertnetymk wants to merge 2 commits intoopenjdk:masterfrom
albertnetymk:pgc-drain-stack
Closed

8300447: Parallel: Refactor PSPromotionManager::drain_stacks_depth#12063
albertnetymk wants to merge 2 commits intoopenjdk:masterfrom
albertnetymk:pgc-drain-stack

Conversation

@albertnetymk
Copy link
Member

@albertnetymk albertnetymk commented Jan 18, 2023

Simple refactoring based on the counterpart in G1.

Test: hotspot_gc


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-8300447: Parallel: Refactor PSPromotionManager::drain_stacks_depth

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12063

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 18, 2023

👋 Welcome back ayang! 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 8300447 8300447: Parallel: Refactor PSPromotionManager::drain_stacks_depth Jan 18, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 18, 2023
@openjdk
Copy link

openjdk bot commented Jan 18, 2023

@albertnetymk 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 18, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 18, 2023

Webrevs

Comment on lines +230 to +231
const uint threshold = totally_drain ? 0
: _target_stack_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to ignore: I would prefer to not spread very simple ?: statements like this over multiple lines. This is imo less readable than keeping it in a single line (and ?: statements should always be very small/short anyway).

Choose a reason for hiding this comment

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

+1

Comment on lines 240 to +246
process_popped_location_depth(task);
}

if (totally_drain) {
while (tq->pop_local(task)) {
process_popped_location_depth(task);
}
} else {
while (tq->size() > _target_stack_size && tq->pop_local(task)) {
process_popped_location_depth(task);
}
while (tq->pop_local(task, threshold)) {
process_popped_location_depth(task);
}
} while ((totally_drain && !tq->taskqueue_empty()) || !tq->overflow_empty());
} while (!tq->overflow_empty());
Copy link
Contributor

Choose a reason for hiding this comment

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

The other, similar loops like the ones in G1 (but also the ones for parallel full gc) all try to first feed the public queue from the overflow queue like (to avoid other threads from starving while this thread happily processes the overflow queue contents on its own):

do {
  while (tq->pop_overflow(task)) {
    if (!tq->try_push_to_taskqueue(task)) {
      process_popped_location_depth(task);
    }
  }

  while (tq->pop_local(task, threshold)) {
    process_popped_location_depth(task);
  }
} while (!tq->overflow_empty());

Is there a reason to not change the structure of this loop to that better one?

(I am also kind of surprised that this change has not been made yet)

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.

Lgtm.

@openjdk
Copy link

openjdk bot commented Jan 18, 2023

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

8300447: Parallel: Refactor PSPromotionManager::drain_stacks_depth

Reviewed-by: tschatzl, kbarrett

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

  • c3242ee: 8298596: vmTestbase/nsk/sysdict/vm/stress/chain/chain008/chain008.java fails with "NoClassDefFoundError: Could not initialize class java.util.concurrent.ThreadLocalRandom"
  • b3684f4: 8153837: AArch64: Handle special cases for MaxINode & MinINode
  • 754f6e6: 8300237: Minor improvements in MethodHandles
  • 85d8bac: 8300166: Unused array allocation in ProcessPath.doProcessPath
  • c464ef1: 8292741: Convert JvmtiTagMapTable to ResourceHashtable
  • 1aded82: 8300488: Incorrect usage of CATCH_BAD_ALLOC as a macro call
  • bd5ca95: 8300222: Replace NULL with nullptr in share/logging
  • 15a9186: 8300169: Build failure with clang-15
  • d918042: 8300267: Remove duplicated setter/getter for do_not_unlock
  • 7c8b99e: 8300117: Replace use of JNI_COMMIT mode with mode 0
  • ... and 18 more: https://git.openjdk.org/jdk/compare/4cd166ff27c1e03a61855664f61dda4fca9aa5c9...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 18, 2023
Comment on lines +230 to +231
const uint threshold = totally_drain ? 0
: _target_stack_size;

Choose a reason for hiding this comment

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

+1

@albertnetymk
Copy link
Member Author

Thanks for the review.

/integrate

@openjdk
Copy link

openjdk bot commented Jan 19, 2023

Going to push as commit 8f7faa6.
Since your change was applied there have been 65 commits pushed to the master branch:

  • eba87a0: 8300264: Remove metaprogramming/isPointer.hpp
  • 08e6218: 8300526: Test runtime/jni/IsVirtualThread/IsVirtualThread.java should exercise alternative virtual thread implementation
  • cfe5746: 8300242: Replace NULL with nullptr in share/code/
  • 5f66024: 8299959: C2: CmpU::Value must filter overflow computation against local sub computation
  • 5b0af1a: 8208077: File.listRoots performance degradation
  • 2e9cb4b: 8267582: BasicLookAndFeel should not call getComponentPopupMenu twice to get a popup menu
  • 7348b9e: 8300167: Add validation of the raster's layout before using in native
  • 24cdcd4: 8293841: RISC-V: Implementation of Foreign Function & Memory API (Preview)
  • 8e3036c: 8300595: Use improved @see and @link syntax in javax.lang.model and javax.tools
  • 715b509: 8298632: [TESTBUG] Add IR checks in jtreg vectorization tests
  • ... and 55 more: https://git.openjdk.org/jdk/compare/4cd166ff27c1e03a61855664f61dda4fca9aa5c9...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 19, 2023

@albertnetymk Pushed as commit 8f7faa6.

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

@albertnetymk albertnetymk deleted the pgc-drain-stack branch January 19, 2023 11:53
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