RFR: 8080106: Refactor setup of parallel GC threads

Stefan Karlsson stefan.karlsson at oracle.com
Wed May 13 13:17:25 UTC 2015


Hi all,

Please review these patches to unify the ways we specify the number of 
used worker threads. The main goal for these patches is to get rid of 
CollectedHeap::set_par_threads() and CollectedHeap::n_par_threads().

The RFE has been split into multiple sub-tasks:
  8080109: Use single-threaded code in 
Threads::possibly_parallel_oops_do when running with only one worker thread
  8080110: Remove usage of CollectedHeap::n_par_threads() from root 
processing
  8080111: Remove SubTaskDone::_n_threads
  8080112: Replace and remove the last usages of 
CollectedHeap::n_par_threads()
  8080113: Remove CollectedHeap::set_par_threads()

See the description below for each individual patch:

---
http://cr.openjdk.java.net/~stefank/8080109/webrev.00
8080109: Use single-threaded code in Threads::possibly_parallel_oops_do 
when running with only one worker thread

Today, the root processing code differentiates between two types of 
single-threaded executions:

1) n_par_threads() == 0, used from Serial GC and other code paths that 
executes the root processing from the VM Thread.
2) n_par_threads() == 1, used from non-Serial GCs when the 
root_processing is executed by one GC worker thread.

Today, the only code difference is that the latter will use cmpxchg to 
claim the threads in Threads::possibly_parallel_oops_do.

I propose that we use the same code for both values of n_par_threads(), 
and only use the cmpxchg version if we are running with more than one 
worker thread.

---
http://cr.openjdk.java.net/~stefank/8080110/webrev.00
8080110: Remove usage of CollectedHeap::n_par_threads() from root processing

Remove the explicit usages of CollectedHeap::n_par_threads() from the 
root processing code.

The proposal is to pass the number of worker threads via the 
StrongRootsScope object. The StrongRootsScope object is already setup 
from single-threaded code where we know how many worker threads are 
going to be used.

---
http://cr.openjdk.java.net/~stefank/8080111/webrev.00
8080111: Remove SubTaskDone::_n_threads

Remove the need to keep track of the number of worker threads currently 
executing in the sub-tasks of the root processing. Instead use the 
information that is already stored in StrongRootsScope.

---
http://cr.openjdk.java.net/~stefank/8080112/webrev.00
8080112: Replace and remove the last usages of 
CollectedHeap::n_par_threads()

Replace and remove the last usages of CollectedHeap::n_par_threads().

The number of used threads are passed down as arguments to the functions 
that need to know how many threads are currently executing in parallel.

---
http://cr.openjdk.java.net/~stefank/8080113/webrev.00
8080113: Remove CollectedHeap::set_par_threads()

Remove all the calls to the set_par_threads() functions.
---

The combined webrev can be found at:
http://cr.openjdk.java.net/~stefank/8080106/webrev.00/

Tested with JPRT and gc-test-suite

Thanks,
StefanK


More information about the hotspot-gc-dev mailing list