8155229: Tune thread usage for live data clearing
authortschatzl
Mon, 02 May 2016 10:24:41 +0200
changeset 38157 49d65a3ea6b6
parent 38156 e0ff734fa7de
child 38159 dd85f2d97400
8155229: Tune thread usage for live data clearing Reviewed-by: mgerdin, drwhite
hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp
--- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Mon May 02 10:24:41 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp	Mon May 02 10:24:41 2016 +0200
@@ -424,9 +424,12 @@
   guarantee(Universe::is_fully_initialized(), "Should not call this during initialization.");
 
   size_t const num_chunks = align_size_up(live_cards_bm().size_in_bytes(), G1ClearCardLiveDataTask::chunk_size()) / G1ClearCardLiveDataTask::chunk_size();
+  uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
 
   G1ClearCardLiveDataTask cl(live_cards_bm(), num_chunks);
-  workers->run_task(&cl);
+
+  log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks);
+  workers->run_task(&cl, num_workers);
 
   // The region live bitmap is always very small, even for huge heaps. Clear
   // directly.