comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 3823:14a2fd14c0db

7068240: G1: Long "parallel other time" and "ext root scanning" when running specific benchmark Summary: In root processing, move the scanning of the reference processor's discovered lists to before RSet updating and scanning. When scanning the reference processor's discovered lists, use a buffering closure so that the time spent copying any reference object is correctly attributed. Also removed a couple of unused and irrelevant timers. Reviewed-by: ysr, jmasa
author johnc
date Mon, 01 Aug 2011 10:04:28 -0700
parents 5f6f2615433a
children 6aa4feb8a366
comparison
equal deleted inserted replaced
3821:8107273fd204 3823:14a2fd14c0db
4832 scan_root_cl, 4832 scan_root_cl,
4833 &push_heap_rs_cl, 4833 &push_heap_rs_cl,
4834 scan_perm_cl, 4834 scan_perm_cl,
4835 i); 4835 i);
4836 pss.end_strong_roots(); 4836 pss.end_strong_roots();
4837
4837 { 4838 {
4838 double start = os::elapsedTime(); 4839 double start = os::elapsedTime();
4839 G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator); 4840 G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator);
4840 evac.do_void(); 4841 evac.do_void();
4841 double elapsed_ms = (os::elapsedTime()-start)*1000.0; 4842 double elapsed_ms = (os::elapsedTime()-start)*1000.0;
4888 collecting_perm_gen, so, 4889 collecting_perm_gen, so,
4889 &buf_scan_non_heap_roots, 4890 &buf_scan_non_heap_roots,
4890 &eager_scan_code_roots, 4891 &eager_scan_code_roots,
4891 &buf_scan_perm); 4892 &buf_scan_perm);
4892 4893
4893 // Finish up any enqueued closure apps. 4894 // Now the ref_processor roots.
4894 buf_scan_non_heap_roots.done();
4895 buf_scan_perm.done();
4896 double ext_roots_end = os::elapsedTime();
4897 g1_policy()->reset_obj_copy_time(worker_i);
4898 double obj_copy_time_sec =
4899 buf_scan_non_heap_roots.closure_app_seconds() +
4900 buf_scan_perm.closure_app_seconds();
4901 g1_policy()->record_obj_copy_time(worker_i, obj_copy_time_sec * 1000.0);
4902 double ext_root_time_ms =
4903 ((ext_roots_end - ext_roots_start) - obj_copy_time_sec) * 1000.0;
4904 g1_policy()->record_ext_root_scan_time(worker_i, ext_root_time_ms);
4905
4906 // Scan strong roots in mark stack.
4907 if (!_process_strong_tasks->is_task_claimed(G1H_PS_mark_stack_oops_do)) {
4908 concurrent_mark()->oops_do(scan_non_heap_roots);
4909 }
4910 double mark_stack_scan_ms = (os::elapsedTime() - ext_roots_end) * 1000.0;
4911 g1_policy()->record_mark_stack_scan_time(worker_i, mark_stack_scan_ms);
4912
4913 // XXX What should this be doing in the parallel case?
4914 g1_policy()->record_collection_pause_end_CH_strong_roots();
4915 // Now scan the complement of the collection set.
4916 if (scan_rs != NULL) {
4917 g1_rem_set()->oops_into_collection_set_do(scan_rs, worker_i);
4918 }
4919 // Finish with the ref_processor roots.
4920 if (!_process_strong_tasks->is_task_claimed(G1H_PS_refProcessor_oops_do)) { 4895 if (!_process_strong_tasks->is_task_claimed(G1H_PS_refProcessor_oops_do)) {
4921 // We need to treat the discovered reference lists as roots and 4896 // We need to treat the discovered reference lists as roots and
4922 // keep entries (which are added by the marking threads) on them 4897 // keep entries (which are added by the marking threads) on them
4923 // live until they can be processed at the end of marking. 4898 // live until they can be processed at the end of marking.
4924 ref_processor()->weak_oops_do(scan_non_heap_roots); 4899 ref_processor()->weak_oops_do(&buf_scan_non_heap_roots);
4925 ref_processor()->oops_do(scan_non_heap_roots); 4900 ref_processor()->oops_do(&buf_scan_non_heap_roots);
4926 } 4901 }
4927 g1_policy()->record_collection_pause_end_G1_strong_roots(); 4902
4903 // Finish up any enqueued closure apps (attributed as object copy time).
4904 buf_scan_non_heap_roots.done();
4905 buf_scan_perm.done();
4906
4907 double ext_roots_end = os::elapsedTime();
4908
4909 g1_policy()->reset_obj_copy_time(worker_i);
4910 double obj_copy_time_sec = buf_scan_perm.closure_app_seconds() +
4911 buf_scan_non_heap_roots.closure_app_seconds();
4912 g1_policy()->record_obj_copy_time(worker_i, obj_copy_time_sec * 1000.0);
4913
4914 double ext_root_time_ms =
4915 ((ext_roots_end - ext_roots_start) - obj_copy_time_sec) * 1000.0;
4916
4917 g1_policy()->record_ext_root_scan_time(worker_i, ext_root_time_ms);
4918
4919 // Scan strong roots in mark stack.
4920 if (!_process_strong_tasks->is_task_claimed(G1H_PS_mark_stack_oops_do)) {
4921 concurrent_mark()->oops_do(scan_non_heap_roots);
4922 }
4923 double mark_stack_scan_ms = (os::elapsedTime() - ext_roots_end) * 1000.0;
4924 g1_policy()->record_mark_stack_scan_time(worker_i, mark_stack_scan_ms);
4925
4926 // Now scan the complement of the collection set.
4927 if (scan_rs != NULL) {
4928 g1_rem_set()->oops_into_collection_set_do(scan_rs, worker_i);
4929 }
4930
4928 _process_strong_tasks->all_tasks_completed(); 4931 _process_strong_tasks->all_tasks_completed();
4929 } 4932 }
4930 4933
4931 void 4934 void
4932 G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure, 4935 G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure,