annotate src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @ 20417:d35872270666

8057658: Enable G1 FullGC extensions Summary: Refactored the G1 FullGC code to enable it to be extended. Reviewed-by: mgerdin, brutisso
author sjohanss
date Tue, 09 Sep 2014 00:05:25 +0200
parents 1f1d373cd044
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
1 /*
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
4 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
7 * published by the Free Software Foundation.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
8 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
13 * accompanied this code).
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
14 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1282
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1282
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1282
diff changeset
21 * questions.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
22 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
23 */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
27
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
28 #include "gc_implementation/g1/g1HotCardCache.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
29 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
30 #include "runtime/thread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
31 #include "utilities/globalDefinitions.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
32
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
33 // Forward decl
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
34 class ConcurrentG1RefineThread;
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
35 class G1CollectedHeap;
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
36 class G1HotCardCache;
20337
1f1d373cd044 8038423: G1: Decommit memory within heap
tschatzl
parents: 20216
diff changeset
37 class G1RegionToSpaceMapper;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
38 class G1RemSet;
10372
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
39 class DirtyCardQueue;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
40
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3258
diff changeset
41 class ConcurrentG1Refine: public CHeapObj<mtGC> {
794
315a5d70b295 6484957: G1: parallel concurrent refinement
iveresov
parents: 579
diff changeset
42 ConcurrentG1RefineThread** _threads;
17844
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 10372
diff changeset
43 uint _n_threads;
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 10372
diff changeset
44 uint _n_worker_threads;
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
45 /*
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
46 * The value of the update buffer queue length falls into one of 3 zones:
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
47 * green, yellow, red. If the value is in [0, green) nothing is
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
48 * done, the buffers are left unprocessed to enable the caching effect of the
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
49 * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
50 * threads are gradually activated. In [yellow, red) all threads are
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
51 * running. If the length becomes red (max queue length) the mutators start
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
52 * processing the buffers.
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
53 *
1282
b81f3572f355 6928059: G1: command line parameter renaming
tonyp
parents: 1111
diff changeset
54 * There are some interesting cases (when G1UseAdaptiveConcRefinement
b81f3572f355 6928059: G1: command line parameter renaming
tonyp
parents: 1111
diff changeset
55 * is turned off):
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
56 * 1) green = yellow = red = 0. In this case the mutator will process all
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
57 * buffers. Except for those that are created by the deferred updates
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
58 * machinery during a collection.
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
59 * 2) green = 0. Means no caching. Can be a good way to minimize the
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
60 * amount of time spent updating rsets during a collection.
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
61 */
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
62 int _green_zone;
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
63 int _yellow_zone;
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
64 int _red_zone;
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
65
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
66 int _thread_threshold_step;
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
67
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
68 // We delay the refinement of 'hot' cards using the hot card cache.
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
69 G1HotCardCache _hot_card_cache;
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
70
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
71 // Reset the threshold step value based of the current zone boundaries.
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
72 void reset_threshold_step();
890
6cb8e9df7174 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 889
diff changeset
73
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
74 public:
20216
570cb6369f17 8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents: 17844
diff changeset
75 ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
76 ~ConcurrentG1Refine();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
77
20337
1f1d373cd044 8038423: G1: Decommit memory within heap
tschatzl
parents: 20216
diff changeset
78 void init(G1RegionToSpaceMapper* card_counts_storage);
794
315a5d70b295 6484957: G1: parallel concurrent refinement
iveresov
parents: 579
diff changeset
79 void stop();
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
80
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
81 void reinitialize_threads();
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
82
10372
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
83 // Iterate over all concurrent refinement threads
794
315a5d70b295 6484957: G1: parallel concurrent refinement
iveresov
parents: 579
diff changeset
84 void threads_do(ThreadClosure *tc);
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
85
10372
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
86 // Iterate over all worker refinement threads
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
87 void worker_threads_do(ThreadClosure * tc);
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
88
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
89 // The RS sampling thread
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
90 ConcurrentG1RefineThread * sampling_thread() const;
e72f7eecc96d 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 10246
diff changeset
91
17844
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 10372
diff changeset
92 static uint thread_num();
1019
035d2e036a9b 6885041: G1: inconsistent thread dump
tonyp
parents: 890
diff changeset
93
035d2e036a9b 6885041: G1: inconsistent thread dump
tonyp
parents: 890
diff changeset
94 void print_worker_threads_on(outputStream* st) const;
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
95
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
96 void set_green_zone(int x) { _green_zone = x; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
97 void set_yellow_zone(int x) { _yellow_zone = x; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
98 void set_red_zone(int x) { _red_zone = x; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
99
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
100 int green_zone() const { return _green_zone; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
101 int yellow_zone() const { return _yellow_zone; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
102 int red_zone() const { return _red_zone; }
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
103
17844
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 10372
diff changeset
104 uint total_thread_num() const { return _n_threads; }
8847586c9037 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 10372
diff changeset
105 uint worker_thread_num() const { return _n_worker_threads; }
1111
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
106
44f61c24ddab 6862387: tune concurrent refinement further
iveresov
parents: 1019
diff changeset
107 int thread_threshold_step() const { return _thread_threshold_step; }
10246
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
108
194f52aa2f23 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 6842
diff changeset
109 G1HotCardCache* hot_card_cache() { return &_hot_card_cache; }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
110 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
111
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1705
diff changeset
112 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTG1REFINE_HPP