8204618: The parallel GC reference processing task executor enqueues a wrong number of tasks into the queue
Reviewed-by: sangheki, kbarrett
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp Mon Jun 11 12:09:57 2018 +0200
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp Mon Jun 11 12:09:59 2018 +0200
@@ -149,19 +149,16 @@
void RefProcTaskExecutor::execute(ProcessTask& task)
{
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
- uint parallel_gc_threads = heap->gc_task_manager()->workers();
uint active_gc_threads = heap->gc_task_manager()->active_workers();
OopTaskQueueSet* qset = ParCompactionManager::stack_array();
ParallelTaskTerminator terminator(active_gc_threads, qset);
GCTaskQueue* q = GCTaskQueue::create();
- for(uint i=0; i<parallel_gc_threads; i++) {
+ for(uint i=0; i<active_gc_threads; i++) {
q->enqueue(new RefProcTaskProxy(task, i));
}
- if (task.marks_oops_alive()) {
- if (parallel_gc_threads>1) {
- for (uint j=0; j<active_gc_threads; j++) {
- q->enqueue(new StealMarkingTask(&terminator));
- }
+ if (task.marks_oops_alive() && (active_gc_threads>1)) {
+ for (uint j=0; j<active_gc_threads; j++) {
+ q->enqueue(new StealMarkingTask(&terminator));
}
}
PSParallelCompact::gc_task_manager()->execute_and_wait(q);