8161993: G1 crashes if active_processor_count changes during startup

Use the initial active processor count for memory initialization instead of the current active one.

Reviewed-by: dholmes, mgerdin
This commit is contained in:
Thomas Schatzl 2016-07-26 11:04:20 +02:00
parent 7c45404684
commit 2313844e20
3 changed files with 4 additions and 5 deletions

View File

@ -122,7 +122,7 @@ DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
// Determines how many mutator threads can process the buffers in parallel.
uint DirtyCardQueueSet::num_par_ids() {
return (uint)os::processor_count();
return (uint)os::initial_active_processor_count();
}
void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl,

View File

@ -416,11 +416,10 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper*
double overall_cm_overhead =
(double) MaxGCPauseMillis * marking_overhead /
(double) GCPauseIntervalMillis;
double cpu_ratio = 1.0 / (double) os::processor_count();
double cpu_ratio = 1.0 / os::initial_active_processor_count();
double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio);
double marking_task_overhead =
overall_cm_overhead / marking_thread_num *
(double) os::processor_count();
overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
double sleep_factor =
(1.0 - marking_task_overhead) / marking_task_overhead;

View File

@ -295,7 +295,7 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
// processor after the first 8. For example, on a 72 cpu machine
// and a chosen fraction of 5/8
// use 8 + (72 - 8) * (5/8) == 48 worker threads.
unsigned int ncpus = (unsigned int) os::active_processor_count();
unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
threads = (ncpus <= switch_pt) ?
ncpus :
(switch_pt + ((ncpus - switch_pt) * num) / den);