提交 2d5d652d 编写于 作者: T tschatzl

8161993: G1 crashes if active_processor_count changes during startup

Summary: Use the initial active processor count for memory initialization instead of the current active one.
Reviewed-by: dholmes, mgerdin
上级 951b359d
/* /*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -631,11 +631,10 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* prev ...@@ -631,11 +631,10 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* prev
double overall_cm_overhead = double overall_cm_overhead =
(double) MaxGCPauseMillis * marking_overhead / (double) MaxGCPauseMillis * marking_overhead /
(double) GCPauseIntervalMillis; (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_thread_num = ceil(overall_cm_overhead / cpu_ratio);
double marking_task_overhead = double marking_task_overhead =
overall_cm_overhead / marking_thread_num * overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
(double) os::processor_count();
double sleep_factor = double sleep_factor =
(1.0 - marking_task_overhead) / marking_task_overhead; (1.0 - marking_task_overhead) / marking_task_overhead;
......
/* /*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -80,7 +80,7 @@ DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) : ...@@ -80,7 +80,7 @@ DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
// Determines how many mutator threads can process the buffers in parallel. // Determines how many mutator threads can process the buffers in parallel.
uint DirtyCardQueueSet::num_par_ids() { uint DirtyCardQueueSet::num_par_ids() {
return (uint)os::processor_count(); return (uint)os::initial_active_processor_count();
} }
void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock, void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
......
/* /*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -296,7 +296,7 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads( ...@@ -296,7 +296,7 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
// processor after the first 8. For example, on a 72 cpu machine // processor after the first 8. For example, on a 72 cpu machine
// and a chosen fraction of 5/8 // and a chosen fraction of 5/8
// use 8 + (72 - 8) * (5/8) == 48 worker threads. // 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();
return (ncpus <= switch_pt) ? return (ncpus <= switch_pt) ?
ncpus : ncpus :
(switch_pt + ((ncpus - switch_pt) * num) / den); (switch_pt + ((ncpus - switch_pt) * num) / den);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册