Commit 8f7bf0a
authored
Don't let VMThread acquire Heap_lock (#300)
The Heap_lock performs safepoint check. Mutators may hold such locks and
enter safepoint. If the VMThread attempts to acquire this lock in a
VMOperation while some mutators are still holding this lock, the
VMThread will have to wait forever because mutators will not resume
until the VMOperation ends. Later versions of OpenJDK forbid the
VMThread from acquiring any lock that performs safepoint check.
We notify the ReferenceHandler thread when resuming mutators. But the
current code does this notification in a VMOperation, and will cause the
deadlock. When this happens, the process will freeze when a GC is
triggered. This is likely to happen when the heap size is small and GC
is triggered often.
We move the notification code to `mmtk_resume_mutators` which is
executed on a GC worker thread *after* mutators have been resumed. This
solves the deadlock issue.1 parent 427eab6 commit 8f7bf0a
2 files changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
90 | 99 | | |
91 | 100 | | |
92 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | 169 | | |
0 commit comments