RFR: 8080877: Don't use workers()->total_workers() when walking G1CollectedHeap::_task_queues

Stefan Karlsson stefan.karlsson at oracle.com
Mon May 25 06:59:28 UTC 2015


On 22/05/15 20:40, Jon Masamitsu wrote:
> Changes look good.
>
> Reviewed.

Thanks.

StefanK

>
> Jon
>
> On 5/22/2015 5:17 AM, Stefan Karlsson wrote:
>> Hi all,
>>
>> The _task_queues are initialized to contain ParallelGCThreads number 
>> of queues:
>>
>>   int n_queues = (int)ParallelGCThreads;
>>   _task_queues = new RefToScanQueueSet(n_queues);
>>
>> When iterating over the queues we use workers()->total_workers() to 
>> determine the number of queues in the set:
>>
>>   const uint n = workers()->total_workers();
>>   for (uint i = 0; i < n; ++i) {
>>     task_queue(i)->stats.reset();
>>   }
>>
>> which gives the same result, since the workers are also initialized 
>> with ParallelGCThreads:
>>
>>   _workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads,
>>                           /* are_GC_task_threads */true,
>>                           /* are_ConcurrentGC_threads */false);
>>   _workers->initialize_workers();
>>
>> I propose that we change the iteration code to ask the task queue set 
>> how many task queues it contain:
>>
>> -  const uint n = workers()->total_workers();
>> +  const uint n = num_task_queues();
>>    for (uint i = 0; i < n; ++i) {
>>      task_queue(i)->stats.reset();
>>    }
>>
>> I also removed the unnecessary forward declarations of OopTaskQueue 
>> and OopTaskQueueSet. This isn't strictly needed for this patch, but 
>> was causing problems while I was prototyping this and other patches.
>>
>> http://cr.openjdk.java.net/~stefank/8080877/webrev.00/
>> https://bugs.openjdk.java.net/browse/JDK-8080877
>>
>> Thanks,
>> StefanK
>




More information about the hotspot-gc-dev mailing list