comparison src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @ 1111:44f61c24ddab

6862387: tune concurrent refinement further Summary: Reworked the concurrent refinement: threads activation, feedback-based threshold adjustment, other miscellaneous fixes. Reviewed-by: apetrusenko, tonyp
author iveresov
date Wed, 16 Dec 2009 15:12:51 -0800
parents 035d2e036a9b
children b81f3572f355
comparison
equal deleted inserted replaced
7:3a2d0223a852 8:36336126c6c4
27 class G1RemSet; 27 class G1RemSet;
28 28
29 class ConcurrentG1Refine: public CHeapObj { 29 class ConcurrentG1Refine: public CHeapObj {
30 ConcurrentG1RefineThread** _threads; 30 ConcurrentG1RefineThread** _threads;
31 int _n_threads; 31 int _n_threads;
32 int _n_worker_threads;
33 /*
34 * The value of the update buffer queue length falls into one of 3 zones:
35 * green, yellow, red. If the value is in [0, green) nothing is
36 * done, the buffers are left unprocessed to enable the caching effect of the
37 * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
38 * threads are gradually activated. In [yellow, red) all threads are
39 * running. If the length becomes red (max queue length) the mutators start
40 * processing the buffers.
41 *
42 * There are some interesting cases (with G1AdaptiveConcRefine turned off):
43 * 1) green = yellow = red = 0. In this case the mutator will process all
44 * buffers. Except for those that are created by the deferred updates
45 * machinery during a collection.
46 * 2) green = 0. Means no caching. Can be a good way to minimize the
47 * amount of time spent updating rsets during a collection.
48 */
49 int _green_zone;
50 int _yellow_zone;
51 int _red_zone;
52
53 int _thread_threshold_step;
54
55 // Reset the threshold step value based of the current zone boundaries.
56 void reset_threshold_step();
32 57
33 // The cache for card refinement. 58 // The cache for card refinement.
34 bool _use_cache; 59 bool _use_cache;
35 bool _def_use_cache; 60 bool _def_use_cache;
36 61
145 ~ConcurrentG1Refine(); 170 ~ConcurrentG1Refine();
146 171
147 void init(); // Accomplish some initialization that has to wait. 172 void init(); // Accomplish some initialization that has to wait.
148 void stop(); 173 void stop();
149 174
175 void reinitialize_threads();
176
150 // Iterate over the conc refine threads 177 // Iterate over the conc refine threads
151 void threads_do(ThreadClosure *tc); 178 void threads_do(ThreadClosure *tc);
152 179
153 // If this is the first entry for the slot, writes into the cache and 180 // If this is the first entry for the slot, writes into the cache and
154 // returns NULL. If it causes an eviction, returns the evicted pointer. 181 // returns NULL. If it causes an eviction, returns the evicted pointer.
176 else _use_cache = false; 203 else _use_cache = false;
177 } 204 }
178 205
179 void clear_and_record_card_counts(); 206 void clear_and_record_card_counts();
180 207
181 static size_t thread_num(); 208 static int thread_num();
182 209
183 void print_worker_threads_on(outputStream* st) const; 210 void print_worker_threads_on(outputStream* st) const;
211
212 void set_green_zone(int x) { _green_zone = x; }
213 void set_yellow_zone(int x) { _yellow_zone = x; }
214 void set_red_zone(int x) { _red_zone = x; }
215
216 int green_zone() const { return _green_zone; }
217 int yellow_zone() const { return _yellow_zone; }
218 int red_zone() const { return _red_zone; }
219
220 int total_thread_num() const { return _n_threads; }
221 int worker_thread_num() const { return _n_worker_threads; }
222
223 int thread_threshold_step() const { return _thread_threshold_step; }
184 }; 224 };