Skip to content

Commit

Permalink
8317960: [17u] Excessive CPU usage on AbstractQueuedSynchronized.isEn…
Browse files Browse the repository at this point in the history
…queued

Reviewed-by: phh
  • Loading branch information
alvdavi authored and Paul Hohensee committed Nov 29, 2023
1 parent 78cc634 commit 14e6812
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,9 @@ private long enableWait(ConditionNode node) {
*/
private boolean canReacquire(ConditionNode node) {
// check links, not status to avoid enqueue race
return node != null && node.prev != null && isEnqueued(node);
Node p; // traverse unless known to be bidirectionally linked
return node != null && (p = node.prev) != null &&
(p.next == node || isEnqueued(node));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,9 @@ private int enableWait(ConditionNode node) {
*/
private boolean canReacquire(ConditionNode node) {
// check links, not status to avoid enqueue race
return node != null && node.prev != null && isEnqueued(node);
Node p; // traverse unless known to be bidirectionally linked
return node != null && (p = node.prev) != null &&
(p.next == node || isEnqueued(node));
}

/**
Expand Down

1 comment on commit 14e6812

@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.