jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8322732: ForkJoinPool may underutilize cores in async mode

Open DougLea opened this issue 1 year ago • 5 comments

This set of changes address causes of poor utilization with small numbers of cores due to overly aggressive contention avoidance. A number of further adjustments were needed to still avoid most contention effects in deployments with large numbers of cores


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8322732: ForkJoinPool may underutilize cores in async mode (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19131

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

Using diff file

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

Webrev

Link to Webrev Comment

DougLea avatar May 07 '24 22:05 DougLea

:wave: Welcome back dl! 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.

bridgekeeper[bot] avatar May 07 '24 22:05 bridgekeeper[bot]

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

8322732: ForkJoinPool may underutilize cores in async mode
8327854: Test java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java failed with RuntimeException

Reviewed-by: alanb

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

  • 2c1b311f81319cee1af574526a91424c2577b78c: 8331854: ubsan: copy.hpp:218:10: runtime error: addition of unsigned offset to 0x7fc2b4024518 overflowed to 0x7fc2b4024510
  • 765ad0e40bc522de4b2821ccc60b9139faf7376f: 8331947: Preview creates checkbox for JEP-less preview feature
  • 8e903eeb1fa04130fa7f154870ffcb1eae36c070: 8331896: JFR: Improve check for JDK classes
  • 3cbdf8d4d4604c92d3760ba4e069216564306bcf: 8333554: Parallel: Remove unused PSParallelCompact::is_in
  • 3944e67366601b6f748df1c5f93f184a7cb23ec3: 8312132: Add tracking of multiple address spaces in NMT
  • d0052c032cc1927e7e92f04cfedab20e0c4e0293: 8333326: Linux Alpine build fails after 8302744
  • 4369856c6dbef15b5d73aa1da07216f372a01294: 8333130: MakeJAR2.sh uses hard-coded JDK version
  • 1f09467230971d6458918ec19ffeb259b8c028a3: 8327368: javac crash when computing exhaustiveness checks
  • 7dbd03388eef9cddbab6a622338b00ce250be3dc: 8332499: Gtest codestrings.validate_vm fail on linux x64 when hsdis is present
  • 9db7c950190853513f4c2afa0efa9a4ff72b60d7: 8332750: Broken link in CatalogFeatures.html
  • ... and 64 more: https://git.openjdk.org/jdk/compare/7ab74c5f268dac82bbd36355acf8e4f3d357134c...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[bot] avatar May 07 '24 22:05 openjdk[bot]

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

  • core-libs

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[bot] avatar May 07 '24 22:05 openjdk[bot]

Maybe I don't quite understand, or I don't have proof, But wouldn't it be better if invokeAll in FIFO mode (asyncMode) traverses the Future list as a FIFO (currently it traverses in LIFO order)

sunmisc avatar May 16 '24 10:05 sunmisc

@sunmisc invokeAll doesn't specify an exec or join order; forward exec snf inverse normally uses fewest resources.

DougLea avatar May 22 '24 23:05 DougLea

Seconding @AlanBateman, I've reviewed and provided feedback on this PR multiple times, and have had numerous runs of parallel streams / gatherers and I think this is good to go. If I was a reviewer my vote would matter, but I'm adding this comment here as an "enthusiastic supporter". :)

viktorklang-ora avatar Jun 05 '24 12:06 viktorklang-ora

/issue JDK-8327854

DougLea avatar Jun 05 '24 13:06 DougLea

@DougLea Adding additional issue to issue list: 8327854: Test java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java failed with RuntimeException.

openjdk[bot] avatar Jun 05 '24 13:06 openjdk[bot]

/integrate

DougLea avatar Jun 05 '24 13:06 DougLea

Going to push as commit 789f704d9ab5aaf87193f508859c4c9a528d7779. Since your change was applied there have been 74 commits pushed to the master branch:

  • 2c1b311f81319cee1af574526a91424c2577b78c: 8331854: ubsan: copy.hpp:218:10: runtime error: addition of unsigned offset to 0x7fc2b4024518 overflowed to 0x7fc2b4024510
  • 765ad0e40bc522de4b2821ccc60b9139faf7376f: 8331947: Preview creates checkbox for JEP-less preview feature
  • 8e903eeb1fa04130fa7f154870ffcb1eae36c070: 8331896: JFR: Improve check for JDK classes
  • 3cbdf8d4d4604c92d3760ba4e069216564306bcf: 8333554: Parallel: Remove unused PSParallelCompact::is_in
  • 3944e67366601b6f748df1c5f93f184a7cb23ec3: 8312132: Add tracking of multiple address spaces in NMT
  • d0052c032cc1927e7e92f04cfedab20e0c4e0293: 8333326: Linux Alpine build fails after 8302744
  • 4369856c6dbef15b5d73aa1da07216f372a01294: 8333130: MakeJAR2.sh uses hard-coded JDK version
  • 1f09467230971d6458918ec19ffeb259b8c028a3: 8327368: javac crash when computing exhaustiveness checks
  • 7dbd03388eef9cddbab6a622338b00ce250be3dc: 8332499: Gtest codestrings.validate_vm fail on linux x64 when hsdis is present
  • 9db7c950190853513f4c2afa0efa9a4ff72b60d7: 8332750: Broken link in CatalogFeatures.html
  • ... and 64 more: https://git.openjdk.org/jdk/compare/7ab74c5f268dac82bbd36355acf8e4f3d357134c...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Jun 05 '24 13:06 openjdk[bot]

@DougLea Pushed as commit 789f704d9ab5aaf87193f508859c4c9a528d7779.

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

openjdk[bot] avatar Jun 05 '24 13:06 openjdk[bot]