comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 3285:49a67202bc67

7011855: G1: non-product flag to artificially grow the heap Summary: It introduces non-product cmd line parameter G1DummyRegionsPerGC which indicates how many "dummy" regions to allocate at the end of each GC. This allows the G1 heap to grow artificially and makes concurrent marking cycles more frequent irrespective of what the application that is running is doing. The dummy regions will be found totally empty during cleanup so this parameter can also be used to stress the concurrent cleanup operation. Reviewed-by: brutisso, johnc
author tonyp
date Tue, 19 Apr 2011 15:46:59 -0400
parents abdfc822206f
children b52782ae3880
comparison
equal deleted inserted replaced
3260:527b586edf24 3285:49a67202bc67
2111 return 2111 return
2112 ((cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) || 2112 ((cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) ||
2113 (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)); 2113 (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent));
2114 } 2114 }
2115 2115
2116 #ifndef PRODUCT
2117 void G1CollectedHeap::allocate_dummy_regions() {
2118 // Let's fill up most of the region
2119 size_t word_size = HeapRegion::GrainWords - 1024;
2120 // And as a result the region we'll allocate will be humongous.
2121 guarantee(isHumongous(word_size), "sanity");
2122
2123 for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
2124 // Let's use the existing mechanism for the allocation
2125 HeapWord* dummy_obj = humongous_obj_allocate(word_size);
2126 if (dummy_obj != NULL) {
2127 MemRegion mr(dummy_obj, word_size);
2128 CollectedHeap::fill_with_object(mr);
2129 } else {
2130 // If we can't allocate once, we probably cannot allocate
2131 // again. Let's get out of the loop.
2132 break;
2133 }
2134 }
2135 }
2136 #endif // !PRODUCT
2137
2116 void G1CollectedHeap::increment_full_collections_completed(bool concurrent) { 2138 void G1CollectedHeap::increment_full_collections_completed(bool concurrent) {
2117 MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag); 2139 MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
2118 2140
2119 // We assume that if concurrent == true, then the caller is a 2141 // We assume that if concurrent == true, then the caller is a
2120 // concurrent thread that was joined the Suspendible Thread 2142 // concurrent thread that was joined the Suspendible Thread
3335 // running. Note: of course, the actual marking work will 3357 // running. Note: of course, the actual marking work will
3336 // not start until the safepoint itself is released in 3358 // not start until the safepoint itself is released in
3337 // ConcurrentGCThread::safepoint_desynchronize(). 3359 // ConcurrentGCThread::safepoint_desynchronize().
3338 doConcurrentMark(); 3360 doConcurrentMark();
3339 } 3361 }
3362
3363 allocate_dummy_regions();
3340 3364
3341 #if YOUNG_LIST_VERBOSE 3365 #if YOUNG_LIST_VERBOSE
3342 gclog_or_tty->print_cr("\nEnd of the pause.\nYoung_list:"); 3366 gclog_or_tty->print_cr("\nEnd of the pause.\nYoung_list:");
3343 _young_list->print(); 3367 _young_list->print();
3344 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); 3368 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);