|
24 | 24 |
|
25 | 25 | #include "precompiled.hpp"
|
26 | 26 | #include "gc/g1/g1CollectedHeap.inline.hpp"
|
27 |
| -#include "gc/g1/g1CollectionSet.hpp" |
28 | 27 | #include "gc/g1/g1ConcurrentMark.inline.hpp"
|
29 | 28 | #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
|
30 |
| -#include "gc/g1/g1Policy.hpp" |
31 | 29 | #include "gc/g1/g1ServiceThread.hpp"
|
32 |
| -#include "gc/g1/heapRegion.inline.hpp" |
33 |
| -#include "gc/g1/heapRegionRemSet.hpp" |
34 |
| -#include "gc/shared/suspendibleThreadSet.hpp" |
35 | 30 | #include "memory/universe.hpp"
|
36 | 31 | #include "runtime/mutexLocker.hpp"
|
37 | 32 | #include "runtime/os.hpp"
|
@@ -100,91 +95,20 @@ class G1PeriodicGCTask : public G1ServiceTask {
|
100 | 95 | }
|
101 | 96 | };
|
102 | 97 |
|
103 |
| -class G1YoungRemSetSamplingClosure : public HeapRegionClosure { |
104 |
| - SuspendibleThreadSetJoiner* _sts; |
105 |
| - size_t _regions_visited; |
106 |
| - size_t _sampled_rs_length; |
107 |
| -public: |
108 |
| - G1YoungRemSetSamplingClosure(SuspendibleThreadSetJoiner* sts) : |
109 |
| - HeapRegionClosure(), _sts(sts), _regions_visited(0), _sampled_rs_length(0) { } |
110 |
| - |
111 |
| - virtual bool do_heap_region(HeapRegion* r) { |
112 |
| - size_t rs_length = r->rem_set()->occupied(); |
113 |
| - _sampled_rs_length += rs_length; |
114 |
| - |
115 |
| - // Update the collection set policy information for this region |
116 |
| - G1CollectedHeap::heap()->collection_set()->update_young_region_prediction(r, rs_length); |
117 |
| - |
118 |
| - _regions_visited++; |
119 |
| - |
120 |
| - if (_regions_visited == 10) { |
121 |
| - if (_sts->should_yield()) { |
122 |
| - _sts->yield(); |
123 |
| - // A gc may have occurred and our sampling data is stale and further |
124 |
| - // traversal of the collection set is unsafe |
125 |
| - return true; |
126 |
| - } |
127 |
| - _regions_visited = 0; |
128 |
| - } |
129 |
| - return false; |
130 |
| - } |
131 |
| - |
132 |
| - size_t sampled_rs_length() const { return _sampled_rs_length; } |
133 |
| -}; |
134 |
| - |
135 |
| -// Task handling young gen remembered set sampling. |
136 |
| -class G1RemSetSamplingTask : public G1ServiceTask { |
137 |
| - // Sample the current length of remembered sets for young. |
138 |
| - // |
139 |
| - // At the end of the GC G1 determines the length of the young gen based on |
140 |
| - // how much time the next GC can take, and when the next GC may occur |
141 |
| - // according to the MMU. |
142 |
| - // |
143 |
| - // The assumption is that a significant part of the GC is spent on scanning |
144 |
| - // the remembered sets (and many other components), so this thread constantly |
145 |
| - // reevaluates the prediction for the remembered set scanning costs, and potentially |
146 |
| - // G1Policy resizes the young gen. This may do a premature GC or even |
147 |
| - // increase the young gen size to keep pause time length goal. |
148 |
| - void sample_young_list_rs_length(){ |
149 |
| - SuspendibleThreadSetJoiner sts; |
150 |
| - G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
151 |
| - G1Policy* policy = g1h->policy(); |
152 |
| - |
153 |
| - if (policy->use_adaptive_young_list_length()) { |
154 |
| - G1YoungRemSetSamplingClosure cl(&sts); |
155 |
| - |
156 |
| - G1CollectionSet* g1cs = g1h->collection_set(); |
157 |
| - g1cs->iterate(&cl); |
158 |
| - |
159 |
| - if (cl.is_complete()) { |
160 |
| - policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_length()); |
161 |
| - } |
162 |
| - } |
163 |
| - } |
164 |
| -public: |
165 |
| - G1RemSetSamplingTask(const char* name) : G1ServiceTask(name) { } |
166 |
| - virtual void execute() { |
167 |
| - sample_young_list_rs_length(); |
168 |
| - schedule(G1ConcRefinementServiceIntervalMillis); |
169 |
| - } |
170 |
| -}; |
171 |
| - |
172 | 98 | G1ServiceThread::G1ServiceThread() :
|
173 | 99 | ConcurrentGCThread(),
|
174 | 100 | _monitor(Mutex::nonleaf,
|
175 | 101 | "G1ServiceThread monitor",
|
176 | 102 | true,
|
177 | 103 | Monitor::_safepoint_check_never),
|
178 | 104 | _task_queue(),
|
179 |
| - _remset_task(new G1RemSetSamplingTask("Remembered Set Sampling Task")), |
180 | 105 | _periodic_gc_task(new G1PeriodicGCTask("Periodic GC Task")),
|
181 | 106 | _vtime_accum(0) {
|
182 | 107 | set_name("G1 Service");
|
183 | 108 | create_and_start();
|
184 | 109 | }
|
185 | 110 |
|
186 | 111 | G1ServiceThread::~G1ServiceThread() {
|
187 |
| - delete _remset_task; |
188 | 112 | delete _periodic_gc_task;
|
189 | 113 | }
|
190 | 114 |
|
@@ -295,7 +219,6 @@ void G1ServiceThread::run_service() {
|
295 | 219 |
|
296 | 220 | // Register the tasks handled by the service thread.
|
297 | 221 | register_task(_periodic_gc_task);
|
298 |
| - register_task(_remset_task); |
299 | 222 |
|
300 | 223 | while (!should_terminate()) {
|
301 | 224 | G1ServiceTask* task = pop_due_task();
|
|
0 commit comments