Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @ 2185:b7a938236e43
7014679: G1: deadlock during concurrent cleanup
Summary: There's a potential deadlock between the concurrent cleanup thread and the GC workers that are trying to allocate and waiting for more free regions to be made available.
Reviewed-by: iveresov, jcoomes
author | tonyp |
---|---|
date | Mon, 31 Jan 2011 16:28:40 -0500 |
parents | a672e43650cc |
children | 1216415d8e35 |
comparison
equal
deleted
inserted
replaced
2177:3582bf76420e | 2185:b7a938236e43 |
---|---|
249 gclog_or_tty->print_cr("[GC concurrent-cleanup-start]"); | 249 gclog_or_tty->print_cr("[GC concurrent-cleanup-start]"); |
250 } | 250 } |
251 | 251 |
252 // Now do the remainder of the cleanup operation. | 252 // Now do the remainder of the cleanup operation. |
253 _cm->completeCleanup(); | 253 _cm->completeCleanup(); |
254 // Notify anyone who's waiting that there are no more free | |
255 // regions coming. We have to do this before we join the STS, | |
256 // otherwise we might deadlock: a GC worker could be blocked | |
257 // waiting for the notification whereas this thread will be | |
258 // blocked for the pause to finish while it's trying to join | |
259 // the STS, which is conditional on the GC workers finishing. | |
260 g1h->reset_free_regions_coming(); | |
261 | |
254 _sts.join(); | 262 _sts.join(); |
255 g1_policy->record_concurrent_mark_cleanup_completed(); | 263 g1_policy->record_concurrent_mark_cleanup_completed(); |
256 _sts.leave(); | 264 _sts.leave(); |
257 | 265 |
258 double cleanup_end_sec = os::elapsedTime(); | 266 double cleanup_end_sec = os::elapsedTime(); |
260 gclog_or_tty->date_stamp(PrintGCDateStamps); | 268 gclog_or_tty->date_stamp(PrintGCDateStamps); |
261 gclog_or_tty->stamp(PrintGCTimeStamps); | 269 gclog_or_tty->stamp(PrintGCTimeStamps); |
262 gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf]", | 270 gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf]", |
263 cleanup_end_sec - cleanup_start_sec); | 271 cleanup_end_sec - cleanup_start_sec); |
264 } | 272 } |
265 | |
266 // We're done: no more free regions coming. | |
267 g1h->reset_free_regions_coming(); | |
268 } | 273 } |
269 guarantee(cm()->cleanup_list_is_empty(), | 274 guarantee(cm()->cleanup_list_is_empty(), |
270 "at this point there should be no regions on the cleanup list"); | 275 "at this point there should be no regions on the cleanup list"); |
271 | 276 |
272 if (cm()->has_aborted()) { | 277 if (cm()->has_aborted()) { |