comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 2369:92da084fefc9

6668573: CMS: reference processing crash if ParallelCMSThreads > ParallelGCThreads Summary: Use _max_num_q = max(discovery_degree, processing_degree), and let balance_queues() redistribute from discovery_degree to processing_degree of queues. This should also allow a more dynamic and flexible parallelism policy in the future. Reviewed-by: jmasa, johnc
author ysr
date Thu, 17 Mar 2011 10:32:46 -0700
parents 1216415d8e35
children 371bbc844bf1
comparison
equal deleted inserted replaced
2368:dde920245681 2369:92da084fefc9
2139 2139
2140 G1CMIsAliveClosure g1_is_alive(g1h); 2140 G1CMIsAliveClosure g1_is_alive(g1h);
2141 G1CMKeepAliveClosure g1_keep_alive(g1h, this, nextMarkBitMap()); 2141 G1CMKeepAliveClosure g1_keep_alive(g1h, this, nextMarkBitMap());
2142 G1CMDrainMarkingStackClosure 2142 G1CMDrainMarkingStackClosure
2143 g1_drain_mark_stack(nextMarkBitMap(), &_markStack, &g1_keep_alive); 2143 g1_drain_mark_stack(nextMarkBitMap(), &_markStack, &g1_keep_alive);
2144
2145 // We use the work gang from the G1CollectedHeap and we utilize all 2144 // We use the work gang from the G1CollectedHeap and we utilize all
2146 // the worker threads. 2145 // the worker threads.
2147 int active_workers = MAX2(MIN2(g1h->workers()->total_workers(), (int)_max_task_num), 1); 2146 int active_workers = g1h->workers() ? g1h->workers()->total_workers() : 1;
2147 active_workers = MAX2(MIN2(active_workers, (int)_max_task_num), 1);
2148 2148
2149 G1RefProcTaskExecutor par_task_executor(g1h, this, nextMarkBitMap(), 2149 G1RefProcTaskExecutor par_task_executor(g1h, this, nextMarkBitMap(),
2150 g1h->workers(), active_workers); 2150 g1h->workers(), active_workers);
2151
2151 2152
2152 if (rp->processing_is_mt()) { 2153 if (rp->processing_is_mt()) {
2153 // Set the degree of MT here. If the discovery is done MT, there 2154 // Set the degree of MT here. If the discovery is done MT, there
2154 // may have been a different number of threads doing the discovery 2155 // may have been a different number of threads doing the discovery
2155 // and a different number of discovered lists may have Ref objects. 2156 // and a different number of discovered lists may have Ref objects.
2156 // That is OK as long as the Reference lists are balanced (see 2157 // That is OK as long as the Reference lists are balanced (see
2157 // balance_all_queues() and balance_queues()). 2158 // balance_all_queues() and balance_queues()).
2158 rp->set_mt_degree(active_workers); 2159 rp->set_active_mt_degree(active_workers);
2159 2160
2160 rp->process_discovered_references(&g1_is_alive, 2161 rp->process_discovered_references(&g1_is_alive,
2161 &g1_keep_alive, 2162 &g1_keep_alive,
2162 &g1_drain_mark_stack, 2163 &g1_drain_mark_stack,
2163 &par_task_executor); 2164 &par_task_executor);