Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1RemSet.cpp @ 4095:bca17e38de00
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
Summary: Select number of GC threads dynamically based on heap usage and number of Java threads
Reviewed-by: johnc, ysr, jcoomes
author | jmasa |
---|---|
date | Tue, 09 Aug 2011 10:16:01 -0700 |
parents | a88de71c4e3a |
children | dc467e8b2c5e |
comparison
equal
deleted
inserted
replaced
4094:3a298e04d914 | 4095:bca17e38de00 |
---|---|
216 // p threads | 216 // p threads |
217 // Then thread t will start at region t * floor (n/p) | 217 // Then thread t will start at region t * floor (n/p) |
218 | 218 |
219 HeapRegion* G1RemSet::calculateStartRegion(int worker_i) { | 219 HeapRegion* G1RemSet::calculateStartRegion(int worker_i) { |
220 HeapRegion* result = _g1p->collection_set(); | 220 HeapRegion* result = _g1p->collection_set(); |
221 if (ParallelGCThreads > 0) { | 221 if (G1CollectedHeap::use_parallel_gc_threads()) { |
222 size_t cs_size = _g1p->cset_region_length(); | 222 size_t cs_size = _g1p->cset_region_length(); |
223 int n_workers = _g1->workers()->total_workers(); | 223 int n_workers = _g1->workers()->total_workers(); |
224 size_t cs_spans = cs_size / n_workers; | 224 size_t cs_spans = cs_size / n_workers; |
225 size_t ind = cs_spans * worker_i; | 225 size_t ind = cs_spans * worker_i; |
226 for (size_t i = 0; i < ind; i++) | 226 for (size_t i = 0; i < ind; i++) |
428 ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); | 428 ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); |
429 _g1->set_refine_cte_cl_concurrency(false); | 429 _g1->set_refine_cte_cl_concurrency(false); |
430 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); | 430 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |
431 dcqs.concatenate_logs(); | 431 dcqs.concatenate_logs(); |
432 | 432 |
433 if (ParallelGCThreads > 0) { | 433 if (G1CollectedHeap::use_parallel_gc_threads()) { |
434 _seq_task->set_n_threads((int)n_workers()); | 434 // Don't set the number of workers here. It will be set |
435 // when the task is run | |
436 // _seq_task->set_n_termination((int)n_workers()); | |
435 } | 437 } |
436 guarantee( _cards_scanned == NULL, "invariant" ); | 438 guarantee( _cards_scanned == NULL, "invariant" ); |
437 _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers()); | 439 _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers()); |
438 for (uint i = 0; i < n_workers(); ++i) { | 440 for (uint i = 0; i < n_workers(); ++i) { |
439 _cards_scanned[i] = 0; | 441 _cards_scanned[i] = 0; |
576 } | 578 } |
577 | 579 |
578 void G1RemSet::scrub_par(BitMap* region_bm, BitMap* card_bm, | 580 void G1RemSet::scrub_par(BitMap* region_bm, BitMap* card_bm, |
579 int worker_num, int claim_val) { | 581 int worker_num, int claim_val) { |
580 ScrubRSClosure scrub_cl(region_bm, card_bm); | 582 ScrubRSClosure scrub_cl(region_bm, card_bm); |
581 _g1->heap_region_par_iterate_chunked(&scrub_cl, worker_num, claim_val); | 583 _g1->heap_region_par_iterate_chunked(&scrub_cl, |
584 worker_num, | |
585 (int) n_workers(), | |
586 claim_val); | |
582 } | 587 } |
583 | 588 |
584 | 589 |
585 static IntHistogram out_of_histo(50, 50); | 590 static IntHistogram out_of_histo(50, 50); |
586 | 591 |