comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 355:0edda524b58c

6722565: G1: assert !r->is_on_unclean_list() fires Summary: Under certain circumstances, two cleanup threads can claim and process the same region. Reviewed-by: apetrusenko, ysr
author tonyp
date Wed, 06 Aug 2008 11:57:31 -0400
parents afc1ce1efe66
children c96030fff130
comparison
equal deleted inserted replaced
354:c0f8f7790199 355:0edda524b58c
1421 _bm, _g1h->concurrent_mark(), 1421 _bm, _g1h->concurrent_mark(),
1422 _region_bm, _card_bm, 1422 _region_bm, _card_bm,
1423 NULL /* CO tracker */); 1423 NULL /* CO tracker */);
1424 calccl.no_yield(); 1424 calccl.no_yield();
1425 if (ParallelGCThreads > 0) { 1425 if (ParallelGCThreads > 0) {
1426 _g1h->heap_region_par_iterate_chunked(&calccl, i, 1); 1426 _g1h->heap_region_par_iterate_chunked(&calccl, i,
1427 HeapRegion::FinalCountClaimValue);
1427 } else { 1428 } else {
1428 _g1h->heap_region_iterate(&calccl); 1429 _g1h->heap_region_iterate(&calccl);
1429 } 1430 }
1430 assert(calccl.complete(), "Shouldn't have yielded!"); 1431 assert(calccl.complete(), "Shouldn't have yielded!");
1431 1432
1500 double start = os::elapsedTime(); 1501 double start = os::elapsedTime();
1501 G1NoteEndOfConcMarkClosure g1_note_end(_g1h, 1502 G1NoteEndOfConcMarkClosure g1_note_end(_g1h,
1502 &_par_cleanup_thread_state[i]->list, 1503 &_par_cleanup_thread_state[i]->list,
1503 i); 1504 i);
1504 if (ParallelGCThreads > 0) { 1505 if (ParallelGCThreads > 0) {
1505 _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, 2); 1506 _g1h->heap_region_par_iterate_chunked(&g1_note_end, i,
1507 HeapRegion::NoteEndClaimValue);
1506 } else { 1508 } else {
1507 _g1h->heap_region_iterate(&g1_note_end); 1509 _g1h->heap_region_iterate(&g1_note_end);
1508 } 1510 }
1509 assert(g1_note_end.complete(), "Shouldn't have yielded!"); 1511 assert(g1_note_end.complete(), "Shouldn't have yielded!");
1510 1512
1543 _region_bm(region_bm), _card_bm(card_bm) 1545 _region_bm(region_bm), _card_bm(card_bm)
1544 {} 1546 {}
1545 1547
1546 void work(int i) { 1548 void work(int i) {
1547 if (ParallelGCThreads > 0) { 1549 if (ParallelGCThreads > 0) {
1548 _g1rs->scrub_par(_region_bm, _card_bm, i, 3); 1550 _g1rs->scrub_par(_region_bm, _card_bm, i,
1551 HeapRegion::ScrubRemSetClaimValue);
1549 } else { 1552 } else {
1550 _g1rs->scrub(_region_bm, _card_bm); 1553 _g1rs->scrub(_region_bm, _card_bm);
1551 } 1554 }
1552 } 1555 }
1553 1556
1608 1611
1609 // Do counting once more with the world stopped for good measure. 1612 // Do counting once more with the world stopped for good measure.
1610 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), 1613 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(),
1611 &_region_bm, &_card_bm); 1614 &_region_bm, &_card_bm);
1612 if (ParallelGCThreads > 0) { 1615 if (ParallelGCThreads > 0) {
1616 assert(g1h->check_heap_region_claim_values(
1617 HeapRegion::InitialClaimValue),
1618 "sanity check");
1619
1613 int n_workers = g1h->workers()->total_workers(); 1620 int n_workers = g1h->workers()->total_workers();
1614 g1h->set_par_threads(n_workers); 1621 g1h->set_par_threads(n_workers);
1615 g1h->workers()->run_task(&g1_par_count_task); 1622 g1h->workers()->run_task(&g1_par_count_task);
1616 g1h->set_par_threads(0); 1623 g1h->set_par_threads(0);
1624
1625 assert(g1h->check_heap_region_claim_values(
1626 HeapRegion::FinalCountClaimValue),
1627 "sanity check");
1617 } else { 1628 } else {
1618 g1_par_count_task.work(0); 1629 g1_par_count_task.work(0);
1619 } 1630 }
1620 1631
1621 size_t known_garbage_bytes = 1632 size_t known_garbage_bytes =
1652 if (ParallelGCThreads > 0) { 1663 if (ParallelGCThreads > 0) {
1653 int n_workers = g1h->workers()->total_workers(); 1664 int n_workers = g1h->workers()->total_workers();
1654 g1h->set_par_threads(n_workers); 1665 g1h->set_par_threads(n_workers);
1655 g1h->workers()->run_task(&g1_par_note_end_task); 1666 g1h->workers()->run_task(&g1_par_note_end_task);
1656 g1h->set_par_threads(0); 1667 g1h->set_par_threads(0);
1668
1669 assert(g1h->check_heap_region_claim_values(HeapRegion::NoteEndClaimValue),
1670 "sanity check");
1657 } else { 1671 } else {
1658 g1_par_note_end_task.work(0); 1672 g1_par_note_end_task.work(0);
1659 } 1673 }
1660 g1h->set_unclean_regions_coming(true); 1674 g1h->set_unclean_regions_coming(true);
1661 double note_end_end = os::elapsedTime(); 1675 double note_end_end = os::elapsedTime();
1663 if (G1PrintParCleanupStats) { 1677 if (G1PrintParCleanupStats) {
1664 gclog_or_tty->print_cr(" note end of marking: %8.3f ms.", 1678 gclog_or_tty->print_cr(" note end of marking: %8.3f ms.",
1665 (note_end_end - note_end_start)*1000.0); 1679 (note_end_end - note_end_start)*1000.0);
1666 } 1680 }
1667 1681
1668 // Now we "scrub" remembered sets. Note that we must do this before the 1682
1669 // call below, since it affects the metric by which we sort the heap 1683 // call below, since it affects the metric by which we sort the heap
1670 // regions. 1684 // regions.
1671 if (G1ScrubRemSets) { 1685 if (G1ScrubRemSets) {
1672 double rs_scrub_start = os::elapsedTime(); 1686 double rs_scrub_start = os::elapsedTime();
1673 G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm); 1687 G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm);
1674 if (ParallelGCThreads > 0) { 1688 if (ParallelGCThreads > 0) {
1675 int n_workers = g1h->workers()->total_workers(); 1689 int n_workers = g1h->workers()->total_workers();
1676 g1h->set_par_threads(n_workers); 1690 g1h->set_par_threads(n_workers);
1677 g1h->workers()->run_task(&g1_par_scrub_rs_task); 1691 g1h->workers()->run_task(&g1_par_scrub_rs_task);
1678 g1h->set_par_threads(0); 1692 g1h->set_par_threads(0);
1693
1694 assert(g1h->check_heap_region_claim_values(
1695 HeapRegion::ScrubRemSetClaimValue),
1696 "sanity check");
1679 } else { 1697 } else {
1680 g1_par_scrub_rs_task.work(0); 1698 g1_par_scrub_rs_task.work(0);
1681 } 1699 }
1682 1700
1683 double rs_scrub_end = os::elapsedTime(); 1701 double rs_scrub_end = os::elapsedTime();