src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp
changeset 58264 4e96939a5746
parent 57953 d78c910f9069
child 58508 d6058bd73982
equal deleted inserted replaced
58263:4fbc534fdf69 58264:4e96939a5746
   196 inline size_t activation_level(const Thresholds& t) { return t.first; }
   196 inline size_t activation_level(const Thresholds& t) { return t.first; }
   197 inline size_t deactivation_level(const Thresholds& t) { return t.second; }
   197 inline size_t deactivation_level(const Thresholds& t) { return t.second; }
   198 
   198 
   199 static Thresholds calc_thresholds(size_t green_zone,
   199 static Thresholds calc_thresholds(size_t green_zone,
   200                                   size_t yellow_zone,
   200                                   size_t yellow_zone,
   201                                   uint worker_i) {
   201                                   uint worker_id) {
   202   double yellow_size = yellow_zone - green_zone;
   202   double yellow_size = yellow_zone - green_zone;
   203   double step = yellow_size / G1ConcurrentRefine::max_num_threads();
   203   double step = yellow_size / G1ConcurrentRefine::max_num_threads();
   204   if (worker_i == 0) {
   204   if (worker_id == 0) {
   205     // Potentially activate worker 0 more aggressively, to keep
   205     // Potentially activate worker 0 more aggressively, to keep
   206     // available buffers near green_zone value.  When yellow_size is
   206     // available buffers near green_zone value.  When yellow_size is
   207     // large we don't want to allow a full step to accumulate before
   207     // large we don't want to allow a full step to accumulate before
   208     // doing any processing, as that might lead to significantly more
   208     // doing any processing, as that might lead to significantly more
   209     // than green_zone buffers to be processed during scanning.
   209     // than green_zone buffers to be processed during scanning.
   210     step = MIN2(step, ParallelGCThreads / 2.0);
   210     step = MIN2(step, ParallelGCThreads / 2.0);
   211   }
   211   }
   212   size_t activate_offset = static_cast<size_t>(ceil(step * (worker_i + 1)));
   212   size_t activate_offset = static_cast<size_t>(ceil(step * (worker_id + 1)));
   213   size_t deactivate_offset = static_cast<size_t>(floor(step * worker_i));
   213   size_t deactivate_offset = static_cast<size_t>(floor(step * worker_id));
   214   return Thresholds(green_zone + activate_offset,
   214   return Thresholds(green_zone + activate_offset,
   215                     green_zone + deactivate_offset);
   215                     green_zone + deactivate_offset);
   216 }
   216 }
   217 
   217 
   218 G1ConcurrentRefine::G1ConcurrentRefine(size_t green_zone,
   218 G1ConcurrentRefine::G1ConcurrentRefine(size_t green_zone,