mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
6862387: tune concurrent refinement further
Reworked the concurrent refinement: threads activation, feedback-based threshold adjustment, other miscellaneous fixes. Reviewed-by: apetrusenko, tonyp
This commit is contained in:
parent
1bed5a3ded
commit
1383dc414b
16 changed files with 509 additions and 307 deletions
|
@ -42,28 +42,49 @@ ConcurrentG1Refine::ConcurrentG1Refine() :
|
|||
_n_periods(0),
|
||||
_threads(NULL), _n_threads(0)
|
||||
{
|
||||
if (G1ConcRefine) {
|
||||
_n_threads = (int)thread_num();
|
||||
if (_n_threads > 0) {
|
||||
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads);
|
||||
int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids();
|
||||
ConcurrentG1RefineThread *next = NULL;
|
||||
for (int i = _n_threads - 1; i >= 0; i--) {
|
||||
ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i);
|
||||
assert(t != NULL, "Conc refine should have been created");
|
||||
assert(t->cg1r() == this, "Conc refine thread should refer to this");
|
||||
_threads[i] = t;
|
||||
next = t;
|
||||
}
|
||||
}
|
||||
|
||||
// Ergomonically select initial concurrent refinement parameters
|
||||
if (FLAG_IS_DEFAULT(G1ConcRefineGreenZone)) {
|
||||
FLAG_SET_DEFAULT(G1ConcRefineGreenZone, MAX2<int>(ParallelGCThreads, 1));
|
||||
}
|
||||
set_green_zone(G1ConcRefineGreenZone);
|
||||
|
||||
if (FLAG_IS_DEFAULT(G1ConcRefineYellowZone)) {
|
||||
FLAG_SET_DEFAULT(G1ConcRefineYellowZone, green_zone() * 3);
|
||||
}
|
||||
set_yellow_zone(MAX2<int>(G1ConcRefineYellowZone, green_zone()));
|
||||
|
||||
if (FLAG_IS_DEFAULT(G1ConcRefineRedZone)) {
|
||||
FLAG_SET_DEFAULT(G1ConcRefineRedZone, yellow_zone() * 2);
|
||||
}
|
||||
set_red_zone(MAX2<int>(G1ConcRefineRedZone, yellow_zone()));
|
||||
_n_worker_threads = thread_num();
|
||||
// We need one extra thread to do the young gen rset size sampling.
|
||||
_n_threads = _n_worker_threads + 1;
|
||||
reset_threshold_step();
|
||||
|
||||
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads);
|
||||
int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids();
|
||||
ConcurrentG1RefineThread *next = NULL;
|
||||
for (int i = _n_threads - 1; i >= 0; i--) {
|
||||
ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i);
|
||||
assert(t != NULL, "Conc refine should have been created");
|
||||
assert(t->cg1r() == this, "Conc refine thread should refer to this");
|
||||
_threads[i] = t;
|
||||
next = t;
|
||||
}
|
||||
}
|
||||
|
||||
size_t ConcurrentG1Refine::thread_num() {
|
||||
if (G1ConcRefine) {
|
||||
return (G1ParallelRSetThreads > 0) ? G1ParallelRSetThreads : ParallelGCThreads;
|
||||
void ConcurrentG1Refine::reset_threshold_step() {
|
||||
if (FLAG_IS_DEFAULT(G1ConcRefineThresholdStep)) {
|
||||
_thread_threshold_step = (yellow_zone() - green_zone()) / (worker_thread_num() + 1);
|
||||
} else {
|
||||
_thread_threshold_step = G1ConcRefineThresholdStep;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ConcurrentG1Refine::thread_num() {
|
||||
return MAX2<int>((G1ParallelRSetThreads > 0) ? G1ParallelRSetThreads : ParallelGCThreads, 1);
|
||||
}
|
||||
|
||||
void ConcurrentG1Refine::init() {
|
||||
|
@ -123,6 +144,15 @@ void ConcurrentG1Refine::stop() {
|
|||
}
|
||||
}
|
||||
|
||||
void ConcurrentG1Refine::reinitialize_threads() {
|
||||
reset_threshold_step();
|
||||
if (_threads != NULL) {
|
||||
for (int i = 0; i < _n_threads; i++) {
|
||||
_threads[i]->initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConcurrentG1Refine::~ConcurrentG1Refine() {
|
||||
if (G1ConcRSLogCacheSize > 0) {
|
||||
assert(_card_counts != NULL, "Logic");
|
||||
|
@ -384,4 +414,3 @@ void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {
|
|||
st->cr();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue