Skip to content

8378176: Concurrent GC worker threads may suffer from priority inversion#30242

Open
fisk wants to merge 1 commit intoopenjdk:masterfrom
fisk:8378176_conc_worker_prio
Open

8378176: Concurrent GC worker threads may suffer from priority inversion#30242
fisk wants to merge 1 commit intoopenjdk:masterfrom
fisk:8378176_conc_worker_prio

Conversation

@fisk
Copy link
Contributor

@fisk fisk commented Mar 13, 2026

GC worker threads have elevated OS priorities, which has been found to cause priority inversion.

Increasing the priority of a thread is not something that should be done lightly. It can backfire quite a lot when facing priority inversion. Also, the thought is often that you want one set of threads in your process to be prioritized higher than another set of threads in your process. Except, priorities are global, so it becomes hard to reason about not just the priority of threads within the process, but also whether they are really more important than other threads on the system, or not.

These issues are greater with concurrent GC threads that interact not just with the other GC threads, but also with application threads. The risk for priority inversion is higher then.

Other than the difficulty of getting priorities right, elevating priorities is not possible on Linux and Mac OS, without super user privileges, which seemingly makes any potential "benefits" kind of limited to windows. Yet, running through our suite of benchmarks, no benefits have actually been sighted. Instead, I have seen priority inversion problems with ZGC.

Having concurrent worker threads have blanket high priority without inspecting everything they do with great care, is outright dangerous. This patch makes it so that concurrent GC workers have normal OS priority.


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-8378176: Concurrent GC worker threads may suffer from priority inversion (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30242

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 13, 2026

👋 Welcome back eosterlund! 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
Copy link

openjdk bot commented Mar 13, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Mar 13, 2026
@openjdk
Copy link

openjdk bot commented Mar 13, 2026

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

  • hotspot
  • shenandoah

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.

@fisk
Copy link
Contributor Author

fisk commented Mar 13, 2026

/label add hotspot-gc
/label remove hotspot
/label remove shenandoah

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Mar 13, 2026
@openjdk
Copy link

openjdk bot commented Mar 13, 2026

@fisk
The hotspot-gc label was successfully added.

@openjdk openjdk bot removed the hotspot hotspot-dev@openjdk.org label Mar 13, 2026
@openjdk
Copy link

openjdk bot commented Mar 13, 2026

@fisk
The hotspot label was successfully removed.

@openjdk openjdk bot removed the shenandoah shenandoah-dev@openjdk.org label Mar 13, 2026
@openjdk
Copy link

openjdk bot commented Mar 13, 2026

@fisk
The shenandoah label was successfully removed.

@fisk fisk marked this pull request as ready for review March 13, 2026 16:18
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 13, 2026
@mlbridge
Copy link

mlbridge bot commented Mar 13, 2026

Webrevs

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 rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant