RFR: 8265489: Stress test times out because of long ObjectSynchronizer::monitors_iterate(...) operation

Daniel D.Daugherty dcubed at openjdk.java.net
Fri Sep 3 18:09:39 UTC 2021


On Thu, 19 Aug 2021 21:18:53 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

> monitors_iterate make several checks which often are true before filter monitor by a thread. It might take a lot of time when there are a lot of threads. So it makes sense to first check thread and only then other conditions.

Changes requested by dcubed (Reviewer).

src/hotspot/share/runtime/synchronizer.cpp line 981:

> 979:     if (mid->owner() != thread) {
> 980:       return;
> 981:     }

The `iter` is processing the in-use-list and you're bailing the iteration
when you run into an ObjectMonitor that is not owned by `thread`, but
that doesn't mean that there's not an ObjectMonitor owned by `thread`
later on in the in-use-list.

So I could see you doing a `continue` here, but not a `return`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5194


More information about the hotspot-dev mailing list