Skip to content

Commit

Permalink
8292969: Bad Thread Utilization in ForkJoinPool
Browse files Browse the repository at this point in the history
Reviewed-by: shade, alanb
  • Loading branch information
Doug Lea committed Sep 27, 2022
1 parent dd51f7e commit bc12e95
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1815,9 +1815,9 @@ final void runWorker(WorkQueue w) {
* returning source id or retry indicator.
*
* @param w caller's WorkQueue
* @param prevSrc the previous queue stolen from in current phase, or 0
* @param prevSrc the two previous queues (if nonzero) stolen from in current phase, packed as int
* @param r random seed
* @return id of queue if taken, negative if none found, prevSrc for retry
* @return the next prevSrc value to use, or negative if none found
*/
private int scan(WorkQueue w, int prevSrc, int r) {
WorkQueue[] qs = queues;
Expand All @@ -1835,10 +1835,11 @@ private int scan(WorkQueue w, int prevSrc, int r) {
else if (t != null && WorkQueue.casSlotToNull(a, k, t)) {
q.base = nb;
w.source = src;
if (prevSrc == 0 && q.base == nb && a[nk] != null)
signalWork(); // propagate
if (src + (src << SWIDTH) != prevSrc &&
q.base == nb && a[nk] != null)
signalWork(); // propagate at most twice/run
w.topLevelExec(t, q);
return src;
return src + (prevSrc << SWIDTH);
}
else if (q.array != a || a[k] != null || a[nk] != null)
return prevSrc; // revisit
Expand Down

1 comment on commit bc12e95

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.