author | jwilhelm |
Thu, 03 Oct 2013 21:36:29 +0200 | |
changeset 20398 | b206c580c45f |
parent 17854 | d65bc1546091 |
child 22220 | eb467dfb9585 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
2 |
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
1374 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5033
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5033
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5033
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "gc_implementation/g1/concurrentG1Refine.hpp" |
|
27 |
#include "gc_implementation/g1/concurrentG1RefineThread.hpp" |
|
28 |
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
29 |
#include "gc_implementation/g1/g1HotCardCache.hpp" |
8926
717a49db1743
7026932: G1: No need to abort VM when card count cache expansion fails
johnc
parents:
8683
diff
changeset
|
30 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
31 |
ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) : |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
32 |
_threads(NULL), _n_threads(0), |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
33 |
_hot_card_cache(g1h) |
1374 | 34 |
{ |
4481 | 35 |
// Ergomonically select initial concurrent refinement parameters |
5033 | 36 |
if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) { |
37 |
FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, MAX2<int>(ParallelGCThreads, 1)); |
|
4481 | 38 |
} |
5033 | 39 |
set_green_zone(G1ConcRefinementGreenZone); |
4481 | 40 |
|
5033 | 41 |
if (FLAG_IS_DEFAULT(G1ConcRefinementYellowZone)) { |
42 |
FLAG_SET_DEFAULT(G1ConcRefinementYellowZone, green_zone() * 3); |
|
4481 | 43 |
} |
5033 | 44 |
set_yellow_zone(MAX2<int>(G1ConcRefinementYellowZone, green_zone())); |
4481 | 45 |
|
5033 | 46 |
if (FLAG_IS_DEFAULT(G1ConcRefinementRedZone)) { |
47 |
FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2); |
|
4481 | 48 |
} |
5033 | 49 |
set_red_zone(MAX2<int>(G1ConcRefinementRedZone, yellow_zone())); |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
50 |
|
4481 | 51 |
_n_worker_threads = thread_num(); |
52 |
// We need one extra thread to do the young gen rset size sampling. |
|
53 |
_n_threads = _n_worker_threads + 1; |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
54 |
|
4481 | 55 |
reset_threshold_step(); |
56 |
||
13195 | 57 |
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads, mtGC); |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
58 |
|
4481 | 59 |
int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids(); |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
60 |
|
4481 | 61 |
ConcurrentG1RefineThread *next = NULL; |
62 |
for (int i = _n_threads - 1; i >= 0; i--) { |
|
63 |
ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i); |
|
64 |
assert(t != NULL, "Conc refine should have been created"); |
|
65 |
assert(t->cg1r() == this, "Conc refine thread should refer to this"); |
|
66 |
_threads[i] = t; |
|
67 |
next = t; |
|
1374 | 68 |
} |
69 |
} |
|
70 |
||
4481 | 71 |
void ConcurrentG1Refine::reset_threshold_step() { |
5033 | 72 |
if (FLAG_IS_DEFAULT(G1ConcRefinementThresholdStep)) { |
4481 | 73 |
_thread_threshold_step = (yellow_zone() - green_zone()) / (worker_thread_num() + 1); |
74 |
} else { |
|
5033 | 75 |
_thread_threshold_step = G1ConcRefinementThresholdStep; |
2882
d508a8bac491
6841831: G1: assert(contains_reference(from),"We just added it!") fires
iveresov
parents:
2881
diff
changeset
|
76 |
} |
4481 | 77 |
} |
78 |
||
1374 | 79 |
void ConcurrentG1Refine::init() { |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
80 |
_hot_card_cache.initialize(); |
1374 | 81 |
} |
82 |
||
2881 | 83 |
void ConcurrentG1Refine::stop() { |
84 |
if (_threads != NULL) { |
|
85 |
for (int i = 0; i < _n_threads; i++) { |
|
86 |
_threads[i]->stop(); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
||
4481 | 91 |
void ConcurrentG1Refine::reinitialize_threads() { |
92 |
reset_threshold_step(); |
|
93 |
if (_threads != NULL) { |
|
94 |
for (int i = 0; i < _n_threads; i++) { |
|
95 |
_threads[i]->initialize(); |
|
96 |
} |
|
97 |
} |
|
98 |
} |
|
99 |
||
1374 | 100 |
ConcurrentG1Refine::~ConcurrentG1Refine() { |
2881 | 101 |
if (_threads != NULL) { |
102 |
for (int i = 0; i < _n_threads; i++) { |
|
103 |
delete _threads[i]; |
|
104 |
} |
|
13195 | 105 |
FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC); |
1374 | 106 |
} |
107 |
} |
|
108 |
||
2881 | 109 |
void ConcurrentG1Refine::threads_do(ThreadClosure *tc) { |
110 |
if (_threads != NULL) { |
|
111 |
for (int i = 0; i < _n_threads; i++) { |
|
112 |
tc->do_thread(_threads[i]); |
|
113 |
} |
|
1374 | 114 |
} |
115 |
} |
|
116 |
||
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
117 |
void ConcurrentG1Refine::worker_threads_do(ThreadClosure * tc) { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
118 |
if (_threads != NULL) { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
119 |
for (int i = 0; i < worker_thread_num(); i++) { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
120 |
tc->do_thread(_threads[i]); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
121 |
} |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
122 |
} |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
123 |
} |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
124 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
125 |
int ConcurrentG1Refine::thread_num() { |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
126 |
int n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
127 |
: ParallelGCThreads; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13289
diff
changeset
|
128 |
return MAX2<int>(n_threads, 1); |
1374 | 129 |
} |
4022 | 130 |
|
131 |
void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const { |
|
132 |
for (int i = 0; i < _n_threads; ++i) { |
|
133 |
_threads[i]->print_on(st); |
|
134 |
st->cr(); |
|
135 |
} |
|
136 |
} |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
137 |
|
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
138 |
ConcurrentG1RefineThread * ConcurrentG1Refine::sampling_thread() const { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
139 |
return _threads[worker_thread_num()]; |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
140 |
} |