author | mgerdin |
Fri, 11 Mar 2016 11:22:56 +0100 | |
changeset 37158 | b882bbfa1af0 |
parent 36371 | fd81a4f0ea00 |
child 37510 | cf066fe4531b |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, 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 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP |
26 |
#define SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/g1/g1HotCardCache.hpp" |
33608
7afc768e4d62
8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents:
33204
diff
changeset
|
29 |
#include "gc/g1/g1YoungRemSetSamplingThread.hpp" |
7397 | 30 |
#include "memory/allocation.hpp" |
31 |
#include "runtime/thread.hpp" |
|
32 |
#include "utilities/globalDefinitions.hpp" |
|
33 |
||
1374 | 34 |
// Forward decl |
35 |
class ConcurrentG1RefineThread; |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
36 |
class G1CollectedHeap; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
37 |
class G1HotCardCache; |
37158
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
38 |
class G1Predictions; |
26160 | 39 |
class G1RegionToSpaceMapper; |
1374 | 40 |
class G1RemSet; |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
41 |
class DirtyCardQueue; |
1374 | 42 |
|
13195 | 43 |
class ConcurrentG1Refine: public CHeapObj<mtGC> { |
33608
7afc768e4d62
8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents:
33204
diff
changeset
|
44 |
G1YoungRemSetSamplingThread* _sample_thread; |
7afc768e4d62
8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents:
33204
diff
changeset
|
45 |
|
2881 | 46 |
ConcurrentG1RefineThread** _threads; |
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
17854
diff
changeset
|
47 |
uint _n_worker_threads; |
4481 | 48 |
/* |
49 |
* The value of the update buffer queue length falls into one of 3 zones: |
|
50 |
* green, yellow, red. If the value is in [0, green) nothing is |
|
51 |
* done, the buffers are left unprocessed to enable the caching effect of the |
|
52 |
* dirtied cards. In the yellow zone [green, yellow) the concurrent refinement |
|
53 |
* threads are gradually activated. In [yellow, red) all threads are |
|
54 |
* running. If the length becomes red (max queue length) the mutators start |
|
55 |
* processing the buffers. |
|
56 |
* |
|
5033 | 57 |
* There are some interesting cases (when G1UseAdaptiveConcRefinement |
58 |
* is turned off): |
|
4481 | 59 |
* 1) green = yellow = red = 0. In this case the mutator will process all |
60 |
* buffers. Except for those that are created by the deferred updates |
|
61 |
* machinery during a collection. |
|
62 |
* 2) green = 0. Means no caching. Can be a good way to minimize the |
|
63 |
* amount of time spent updating rsets during a collection. |
|
64 |
*/ |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
65 |
size_t _green_zone; |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
66 |
size_t _yellow_zone; |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
67 |
size_t _red_zone; |
4481 | 68 |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
69 |
size_t _thread_threshold_step; |
4481 | 70 |
|
37158
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
71 |
double _predictor_sigma; |
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
72 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
73 |
// We delay the refinement of 'hot' cards using the hot card cache. |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
74 |
G1HotCardCache _hot_card_cache; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
75 |
|
4481 | 76 |
// Reset the threshold step value based of the current zone boundaries. |
77 |
void reset_threshold_step(); |
|
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3589
diff
changeset
|
78 |
|
37158
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
79 |
ConcurrentG1Refine(G1CollectedHeap* g1h, const G1Predictions* predictions); |
32738
a1adf25202fd
8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents:
30764
diff
changeset
|
80 |
|
1374 | 81 |
public: |
82 |
~ConcurrentG1Refine(); |
|
83 |
||
32738
a1adf25202fd
8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents:
30764
diff
changeset
|
84 |
// Returns ConcurrentG1Refine instance if succeeded to create/initialize ConcurrentG1Refine and ConcurrentG1RefineThread. |
a1adf25202fd
8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents:
30764
diff
changeset
|
85 |
// Otherwise, returns NULL with error code. |
a1adf25202fd
8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents:
30764
diff
changeset
|
86 |
static ConcurrentG1Refine* create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode); |
a1adf25202fd
8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents:
30764
diff
changeset
|
87 |
|
26160 | 88 |
void init(G1RegionToSpaceMapper* card_counts_storage); |
2881 | 89 |
void stop(); |
1374 | 90 |
|
37158
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
91 |
void adjust(double update_rs_time, double update_rs_processed_buffers, double goal_ms); |
b882bbfa1af0
8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents:
36371
diff
changeset
|
92 |
|
4481 | 93 |
void reinitialize_threads(); |
94 |
||
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
95 |
// Iterate over all concurrent refinement threads |
2881 | 96 |
void threads_do(ThreadClosure *tc); |
1374 | 97 |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
98 |
// Iterate over all worker refinement threads |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
99 |
void worker_threads_do(ThreadClosure * tc); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
100 |
|
33608
7afc768e4d62
8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents:
33204
diff
changeset
|
101 |
// The RS sampling thread has nothing to do with refinement, but is here for now. |
7afc768e4d62
8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents:
33204
diff
changeset
|
102 |
G1YoungRemSetSamplingThread * sampling_thread() const { return _sample_thread; } |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
103 |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
17854
diff
changeset
|
104 |
static uint thread_num(); |
4022 | 105 |
|
106 |
void print_worker_threads_on(outputStream* st) const; |
|
4481 | 107 |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
108 |
void set_green_zone(size_t x) { _green_zone = x; } |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
109 |
void set_yellow_zone(size_t x) { _yellow_zone = x; } |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
110 |
void set_red_zone(size_t x) { _red_zone = x; } |
4481 | 111 |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
112 |
size_t green_zone() const { return _green_zone; } |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
113 |
size_t yellow_zone() const { return _yellow_zone; } |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
114 |
size_t red_zone() const { return _red_zone; } |
4481 | 115 |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
17854
diff
changeset
|
116 |
uint worker_thread_num() const { return _n_worker_threads; } |
4481 | 117 |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
33608
diff
changeset
|
118 |
size_t thread_threshold_step() const { return _thread_threshold_step; } |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
119 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
13963
diff
changeset
|
120 |
G1HotCardCache* hot_card_cache() { return &_hot_card_cache; } |
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
32738
diff
changeset
|
121 |
|
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
32738
diff
changeset
|
122 |
static bool hot_card_cache_enabled() { return G1HotCardCache::default_use_cache(); } |
1374 | 123 |
}; |
7397 | 124 |
|
30764 | 125 |
#endif // SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP |