Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 936:e1fdf4fd34dc
6871111: G1: remove the concurrent overhead tracker
Summary: Removing the concurrent overhead tracker from G1, along with the GC overhead reporter and the G1AccountConcurrentOverhead (both of which rely on the the concurrent overhead tracker).
Reviewed-by: iveresov, johnc
author | tonyp |
---|---|
date | Wed, 19 Aug 2009 12:53:25 -0400 |
parents | 308762b2bf14 |
children | 54b3b351d6f9 |
comparison
equal
deleted
inserted
replaced
912:308762b2bf14 | 936:e1fdf4fd34dc |
---|---|
431 _remark_times(), _remark_mark_times(), _remark_weak_ref_times(), | 431 _remark_times(), _remark_mark_times(), _remark_weak_ref_times(), |
432 _cleanup_times(), | 432 _cleanup_times(), |
433 _total_counting_time(0.0), | 433 _total_counting_time(0.0), |
434 _total_rs_scrub_time(0.0), | 434 _total_rs_scrub_time(0.0), |
435 | 435 |
436 _parallel_workers(NULL), | 436 _parallel_workers(NULL) |
437 _cleanup_co_tracker(G1CLGroup) | |
438 { | 437 { |
439 CMVerboseLevel verbose_level = | 438 CMVerboseLevel verbose_level = |
440 (CMVerboseLevel) G1MarkingVerboseLevel; | 439 (CMVerboseLevel) G1MarkingVerboseLevel; |
441 if (verbose_level < no_verbose) | 440 if (verbose_level < no_verbose) |
442 verbose_level = no_verbose; | 441 verbose_level = no_verbose; |
821 | 820 |
822 // update_g1_committed() will be called at the end of an evac pause | 821 // update_g1_committed() will be called at the end of an evac pause |
823 // when marking is on. So, it's also called at the end of the | 822 // when marking is on. So, it's also called at the end of the |
824 // initial-mark pause to update the heap end, if the heap expands | 823 // initial-mark pause to update the heap end, if the heap expands |
825 // during it. No need to call it here. | 824 // during it. No need to call it here. |
826 | |
827 guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); | |
828 | |
829 size_t max_marking_threads = | |
830 MAX2((size_t) 1, parallel_marking_threads()); | |
831 for (int i = 0; i < (int)_max_task_num; ++i) { | |
832 _tasks[i]->enable_co_tracker(); | |
833 if (i < (int) max_marking_threads) | |
834 _tasks[i]->reset_co_tracker(marking_task_overhead()); | |
835 else | |
836 _tasks[i]->reset_co_tracker(0.0); | |
837 } | |
838 } | 825 } |
839 | 826 |
840 // Checkpoint the roots into this generation from outside | 827 // Checkpoint the roots into this generation from outside |
841 // this generation. [Note this initial checkpoint need only | 828 // this generation. [Note this initial checkpoint need only |
842 // be approximate -- we'll do a catch up phase subsequently.] | 829 // be approximate -- we'll do a catch up phase subsequently.] |
843 void ConcurrentMark::checkpointRootsInitial() { | 830 void ConcurrentMark::checkpointRootsInitial() { |
844 assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped"); | 831 assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped"); |
845 G1CollectedHeap* g1h = G1CollectedHeap::heap(); | 832 G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
846 | 833 |
847 double start = os::elapsedTime(); | 834 double start = os::elapsedTime(); |
848 GCOverheadReporter::recordSTWStart(start); | |
849 | 835 |
850 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); | 836 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); |
851 g1p->record_concurrent_mark_init_start(); | 837 g1p->record_concurrent_mark_init_start(); |
852 checkpointRootsInitialPre(); | 838 checkpointRootsInitialPre(); |
853 | 839 |
874 checkpointRootsInitialPost(); | 860 checkpointRootsInitialPost(); |
875 | 861 |
876 // Statistics. | 862 // Statistics. |
877 double end = os::elapsedTime(); | 863 double end = os::elapsedTime(); |
878 _init_times.add((end - start) * 1000.0); | 864 _init_times.add((end - start) * 1000.0); |
879 GCOverheadReporter::recordSTWEnd(end); | |
880 | 865 |
881 g1p->record_concurrent_mark_init_end(); | 866 g1p->record_concurrent_mark_init_end(); |
882 } | 867 } |
883 | 868 |
884 /* | 869 /* |
1033 | 1018 |
1034 ConcurrentGCThread::stsJoin(); | 1019 ConcurrentGCThread::stsJoin(); |
1035 | 1020 |
1036 guarantee( (size_t)worker_i < _cm->active_tasks(), "invariant" ); | 1021 guarantee( (size_t)worker_i < _cm->active_tasks(), "invariant" ); |
1037 CMTask* the_task = _cm->task(worker_i); | 1022 CMTask* the_task = _cm->task(worker_i); |
1038 the_task->start_co_tracker(); | |
1039 the_task->record_start_time(); | 1023 the_task->record_start_time(); |
1040 if (!_cm->has_aborted()) { | 1024 if (!_cm->has_aborted()) { |
1041 do { | 1025 do { |
1042 double start_vtime_sec = os::elapsedVTime(); | 1026 double start_vtime_sec = os::elapsedVTime(); |
1043 double start_time_sec = os::elapsedTime(); | 1027 double start_time_sec = os::elapsedTime(); |
1059 ConcurrentGCThread::stsJoin(); | 1043 ConcurrentGCThread::stsJoin(); |
1060 } | 1044 } |
1061 double end_time2_sec = os::elapsedTime(); | 1045 double end_time2_sec = os::elapsedTime(); |
1062 double elapsed_time2_sec = end_time2_sec - start_time_sec; | 1046 double elapsed_time2_sec = end_time2_sec - start_time_sec; |
1063 | 1047 |
1064 the_task->update_co_tracker(); | |
1065 | |
1066 #if 0 | 1048 #if 0 |
1067 gclog_or_tty->print_cr("CM: elapsed %1.4lf ms, sleep %1.4lf ms, " | 1049 gclog_or_tty->print_cr("CM: elapsed %1.4lf ms, sleep %1.4lf ms, " |
1068 "overhead %1.4lf", | 1050 "overhead %1.4lf", |
1069 elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, | 1051 elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, |
1070 the_task->conc_overhead(os::elapsedTime()) * 8.0); | 1052 the_task->conc_overhead(os::elapsedTime()) * 8.0); |
1077 guarantee( !the_task->has_aborted() || _cm->has_aborted(), "invariant" ); | 1059 guarantee( !the_task->has_aborted() || _cm->has_aborted(), "invariant" ); |
1078 | 1060 |
1079 ConcurrentGCThread::stsLeave(); | 1061 ConcurrentGCThread::stsLeave(); |
1080 | 1062 |
1081 double end_vtime = os::elapsedVTime(); | 1063 double end_vtime = os::elapsedVTime(); |
1082 the_task->update_co_tracker(true); | |
1083 _cm->update_accum_task_vtime(worker_i, end_vtime - start_vtime); | 1064 _cm->update_accum_task_vtime(worker_i, end_vtime - start_vtime); |
1084 } | 1065 } |
1085 | 1066 |
1086 CMConcurrentMarkingTask(ConcurrentMark* cm, | 1067 CMConcurrentMarkingTask(ConcurrentMark* cm, |
1087 ConcurrentMarkThread* cmt) : | 1068 ConcurrentMarkThread* cmt) : |
1131 | 1112 |
1132 G1CollectorPolicy* g1p = g1h->g1_policy(); | 1113 G1CollectorPolicy* g1p = g1h->g1_policy(); |
1133 g1p->record_concurrent_mark_remark_start(); | 1114 g1p->record_concurrent_mark_remark_start(); |
1134 | 1115 |
1135 double start = os::elapsedTime(); | 1116 double start = os::elapsedTime(); |
1136 GCOverheadReporter::recordSTWStart(start); | |
1137 | 1117 |
1138 checkpointRootsFinalWork(); | 1118 checkpointRootsFinalWork(); |
1139 | 1119 |
1140 double mark_work_end = os::elapsedTime(); | 1120 double mark_work_end = os::elapsedTime(); |
1141 | 1121 |
1171 double now = os::elapsedTime(); | 1151 double now = os::elapsedTime(); |
1172 _remark_mark_times.add((mark_work_end - start) * 1000.0); | 1152 _remark_mark_times.add((mark_work_end - start) * 1000.0); |
1173 _remark_weak_ref_times.add((now - mark_work_end) * 1000.0); | 1153 _remark_weak_ref_times.add((now - mark_work_end) * 1000.0); |
1174 _remark_times.add((now - start) * 1000.0); | 1154 _remark_times.add((now - start) * 1000.0); |
1175 | 1155 |
1176 GCOverheadReporter::recordSTWEnd(now); | |
1177 for (int i = 0; i < (int)_max_task_num; ++i) | |
1178 _tasks[i]->disable_co_tracker(); | |
1179 _cleanup_co_tracker.enable(); | |
1180 _cleanup_co_tracker.reset(cleanup_task_overhead()); | |
1181 g1p->record_concurrent_mark_remark_end(); | 1156 g1p->record_concurrent_mark_remark_end(); |
1182 } | 1157 } |
1183 | 1158 |
1184 | 1159 |
1185 #define CARD_BM_TEST_MODE 0 | 1160 #define CARD_BM_TEST_MODE 0 |
1186 | 1161 |
1187 class CalcLiveObjectsClosure: public HeapRegionClosure { | 1162 class CalcLiveObjectsClosure: public HeapRegionClosure { |
1188 | 1163 |
1189 CMBitMapRO* _bm; | 1164 CMBitMapRO* _bm; |
1190 ConcurrentMark* _cm; | 1165 ConcurrentMark* _cm; |
1191 COTracker* _co_tracker; | |
1192 bool _changed; | 1166 bool _changed; |
1193 bool _yield; | 1167 bool _yield; |
1194 size_t _words_done; | 1168 size_t _words_done; |
1195 size_t _tot_live; | 1169 size_t _tot_live; |
1196 size_t _tot_used; | 1170 size_t _tot_used; |
1214 } | 1188 } |
1215 | 1189 |
1216 public: | 1190 public: |
1217 CalcLiveObjectsClosure(bool final, | 1191 CalcLiveObjectsClosure(bool final, |
1218 CMBitMapRO *bm, ConcurrentMark *cm, | 1192 CMBitMapRO *bm, ConcurrentMark *cm, |
1219 BitMap* region_bm, BitMap* card_bm, | 1193 BitMap* region_bm, BitMap* card_bm) : |
1220 COTracker* co_tracker) : | |
1221 _bm(bm), _cm(cm), _changed(false), _yield(true), | 1194 _bm(bm), _cm(cm), _changed(false), _yield(true), |
1222 _words_done(0), _tot_live(0), _tot_used(0), | 1195 _words_done(0), _tot_live(0), _tot_used(0), |
1223 _region_bm(region_bm), _card_bm(card_bm), | 1196 _region_bm(region_bm), _card_bm(card_bm),_final(final), |
1224 _final(final), _co_tracker(co_tracker), | |
1225 _regions_done(0), _start_vtime_sec(0.0) | 1197 _regions_done(0), _start_vtime_sec(0.0) |
1226 { | 1198 { |
1227 _bottom_card_num = | 1199 _bottom_card_num = |
1228 intptr_t(uintptr_t(G1CollectedHeap::heap()->reserved_region().start()) >> | 1200 intptr_t(uintptr_t(G1CollectedHeap::heap()->reserved_region().start()) >> |
1229 CardTableModRefBS::card_shift); | 1201 CardTableModRefBS::card_shift); |
1263 (BitMap::idx_t) end_index, true); | 1235 (BitMap::idx_t) end_index, true); |
1264 } | 1236 } |
1265 } | 1237 } |
1266 | 1238 |
1267 bool doHeapRegion(HeapRegion* hr) { | 1239 bool doHeapRegion(HeapRegion* hr) { |
1268 if (_co_tracker != NULL) | |
1269 _co_tracker->update(); | |
1270 | |
1271 if (!_final && _regions_done == 0) | 1240 if (!_final && _regions_done == 0) |
1272 _start_vtime_sec = os::elapsedVTime(); | 1241 _start_vtime_sec = os::elapsedVTime(); |
1273 | 1242 |
1274 if (hr->continuesHumongous()) { | 1243 if (hr->continuesHumongous()) { |
1275 // We will ignore these here and process them when their | 1244 // We will ignore these here and process them when their |
1394 double end_vtime_sec = os::elapsedVTime(); | 1363 double end_vtime_sec = os::elapsedVTime(); |
1395 double elapsed_vtime_sec = end_vtime_sec - _start_vtime_sec; | 1364 double elapsed_vtime_sec = end_vtime_sec - _start_vtime_sec; |
1396 if (elapsed_vtime_sec > (10.0 / 1000.0)) { | 1365 if (elapsed_vtime_sec > (10.0 / 1000.0)) { |
1397 jlong sleep_time_ms = | 1366 jlong sleep_time_ms = |
1398 (jlong) (elapsed_vtime_sec * _cm->cleanup_sleep_factor() * 1000.0); | 1367 (jlong) (elapsed_vtime_sec * _cm->cleanup_sleep_factor() * 1000.0); |
1399 #if 0 | |
1400 gclog_or_tty->print_cr("CL: elapsed %1.4lf ms, sleep %1.4lf ms, " | |
1401 "overhead %1.4lf", | |
1402 elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, | |
1403 _co_tracker->concOverhead(os::elapsedTime())); | |
1404 #endif | |
1405 os::sleep(Thread::current(), sleep_time_ms, false); | 1368 os::sleep(Thread::current(), sleep_time_ms, false); |
1406 _start_vtime_sec = end_vtime_sec; | 1369 _start_vtime_sec = end_vtime_sec; |
1407 } | 1370 } |
1408 } | 1371 } |
1409 } | 1372 } |
1419 size_t tot_used() { return _tot_used; } | 1382 size_t tot_used() { return _tot_used; } |
1420 }; | 1383 }; |
1421 | 1384 |
1422 | 1385 |
1423 void ConcurrentMark::calcDesiredRegions() { | 1386 void ConcurrentMark::calcDesiredRegions() { |
1424 guarantee( _cleanup_co_tracker.enabled(), "invariant" ); | |
1425 _cleanup_co_tracker.start(); | |
1426 | |
1427 _region_bm.clear(); | 1387 _region_bm.clear(); |
1428 _card_bm.clear(); | 1388 _card_bm.clear(); |
1429 CalcLiveObjectsClosure calccl(false /*final*/, | 1389 CalcLiveObjectsClosure calccl(false /*final*/, |
1430 nextMarkBitMap(), this, | 1390 nextMarkBitMap(), this, |
1431 &_region_bm, &_card_bm, | 1391 &_region_bm, &_card_bm); |
1432 &_cleanup_co_tracker); | |
1433 G1CollectedHeap *g1h = G1CollectedHeap::heap(); | 1392 G1CollectedHeap *g1h = G1CollectedHeap::heap(); |
1434 g1h->heap_region_iterate(&calccl); | 1393 g1h->heap_region_iterate(&calccl); |
1435 | 1394 |
1436 do { | 1395 do { |
1437 calccl.reset(); | 1396 calccl.reset(); |
1438 g1h->heap_region_iterate(&calccl); | 1397 g1h->heap_region_iterate(&calccl); |
1439 } while (calccl.changed()); | 1398 } while (calccl.changed()); |
1440 | |
1441 _cleanup_co_tracker.update(true); | |
1442 } | 1399 } |
1443 | 1400 |
1444 class G1ParFinalCountTask: public AbstractGangTask { | 1401 class G1ParFinalCountTask: public AbstractGangTask { |
1445 protected: | 1402 protected: |
1446 G1CollectedHeap* _g1h; | 1403 G1CollectedHeap* _g1h; |
1470 } | 1427 } |
1471 | 1428 |
1472 void work(int i) { | 1429 void work(int i) { |
1473 CalcLiveObjectsClosure calccl(true /*final*/, | 1430 CalcLiveObjectsClosure calccl(true /*final*/, |
1474 _bm, _g1h->concurrent_mark(), | 1431 _bm, _g1h->concurrent_mark(), |
1475 _region_bm, _card_bm, | 1432 _region_bm, _card_bm); |
1476 NULL /* CO tracker */); | |
1477 calccl.no_yield(); | 1433 calccl.no_yield(); |
1478 if (ParallelGCThreads > 0) { | 1434 if (ParallelGCThreads > 0) { |
1479 _g1h->heap_region_par_iterate_chunked(&calccl, i, | 1435 _g1h->heap_region_par_iterate_chunked(&calccl, i, |
1480 HeapRegion::FinalCountClaimValue); | 1436 HeapRegion::FinalCountClaimValue); |
1481 } else { | 1437 } else { |
1661 Universe::verify(/* allow dirty */ true, | 1617 Universe::verify(/* allow dirty */ true, |
1662 /* silent */ false, | 1618 /* silent */ false, |
1663 /* prev marking */ true); | 1619 /* prev marking */ true); |
1664 } | 1620 } |
1665 | 1621 |
1666 _cleanup_co_tracker.disable(); | |
1667 | |
1668 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); | 1622 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); |
1669 g1p->record_concurrent_mark_cleanup_start(); | 1623 g1p->record_concurrent_mark_cleanup_start(); |
1670 | 1624 |
1671 double start = os::elapsedTime(); | 1625 double start = os::elapsedTime(); |
1672 GCOverheadReporter::recordSTWStart(start); | |
1673 | 1626 |
1674 // Do counting once more with the world stopped for good measure. | 1627 // Do counting once more with the world stopped for good measure. |
1675 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), | 1628 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), |
1676 &_region_bm, &_card_bm); | 1629 &_region_bm, &_card_bm); |
1677 if (ParallelGCThreads > 0) { | 1630 if (ParallelGCThreads > 0) { |
1772 g1_par_note_end_task.max_live_bytes()); | 1725 g1_par_note_end_task.max_live_bytes()); |
1773 | 1726 |
1774 // Statistics. | 1727 // Statistics. |
1775 double end = os::elapsedTime(); | 1728 double end = os::elapsedTime(); |
1776 _cleanup_times.add((end - start) * 1000.0); | 1729 _cleanup_times.add((end - start) * 1000.0); |
1777 GCOverheadReporter::recordSTWEnd(end); | |
1778 | 1730 |
1779 // G1CollectedHeap::heap()->print(); | 1731 // G1CollectedHeap::heap()->print(); |
1780 // gclog_or_tty->print_cr("HEAP GC TIME STAMP : %d", | 1732 // gclog_or_tty->print_cr("HEAP GC TIME STAMP : %d", |
1781 // G1CollectedHeap::heap()->get_gc_time_stamp()); | 1733 // G1CollectedHeap::heap()->get_gc_time_stamp()); |
1782 | 1734 |
2621 return; | 2573 return; |
2622 | 2574 |
2623 HeapWord* region_end = hr->end(); | 2575 HeapWord* region_end = hr->end(); |
2624 if (region_end > _min_finger) | 2576 if (region_end > _min_finger) |
2625 _should_gray_objects = true; | 2577 _should_gray_objects = true; |
2626 } | |
2627 | |
2628 void ConcurrentMark::disable_co_trackers() { | |
2629 if (has_aborted()) { | |
2630 if (_cleanup_co_tracker.enabled()) | |
2631 _cleanup_co_tracker.disable(); | |
2632 for (int i = 0; i < (int)_max_task_num; ++i) { | |
2633 CMTask* task = _tasks[i]; | |
2634 if (task->co_tracker_enabled()) | |
2635 task->disable_co_tracker(); | |
2636 } | |
2637 } else { | |
2638 guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); | |
2639 for (int i = 0; i < (int)_max_task_num; ++i) { | |
2640 CMTask* task = _tasks[i]; | |
2641 guarantee( !task->co_tracker_enabled(), "invariant" ); | |
2642 } | |
2643 } | |
2644 } | 2578 } |
2645 | 2579 |
2646 // abandon current marking iteration due to a Full GC | 2580 // abandon current marking iteration due to a Full GC |
2647 void ConcurrentMark::abort() { | 2581 void ConcurrentMark::abort() { |
2648 // Clear all marks to force marking thread to do nothing | 2582 // Clear all marks to force marking thread to do nothing |
4016 CMTask::CMTask(int task_id, | 3950 CMTask::CMTask(int task_id, |
4017 ConcurrentMark* cm, | 3951 ConcurrentMark* cm, |
4018 CMTaskQueue* task_queue, | 3952 CMTaskQueue* task_queue, |
4019 CMTaskQueueSet* task_queues) | 3953 CMTaskQueueSet* task_queues) |
4020 : _g1h(G1CollectedHeap::heap()), | 3954 : _g1h(G1CollectedHeap::heap()), |
4021 _co_tracker(G1CMGroup), | |
4022 _task_id(task_id), _cm(cm), | 3955 _task_id(task_id), _cm(cm), |
4023 _claimed(false), | 3956 _claimed(false), |
4024 _nextMarkBitMap(NULL), _hash_seed(17), | 3957 _nextMarkBitMap(NULL), _hash_seed(17), |
4025 _task_queue(task_queue), | 3958 _task_queue(task_queue), |
4026 _task_queues(task_queues), | 3959 _task_queues(task_queues), |