8161993: G1 crashes if active_processor_count changes during startup

Thu, 15 Dec 2016 20:00:01 -0500

author
tschatzl
date
Thu, 15 Dec 2016 20:00:01 -0500
changeset 8747
ab892d05b029
parent 8746
ca765f57fe3c
child 8748
75021e6fe108

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

src/share/vm/gc_implementation/g1/concurrentMark.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/vm_version.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Dec 15 19:48:32 2016 -0500
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Thu Dec 15 20:00:01 2016 -0500
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -631,11 +631,10 @@
    1.11        double overall_cm_overhead =
    1.12          (double) MaxGCPauseMillis * marking_overhead /
    1.13          (double) GCPauseIntervalMillis;
    1.14 -      double cpu_ratio = 1.0 / (double) os::processor_count();
    1.15 +      double cpu_ratio = 1.0 / os::initial_active_processor_count();
    1.16        double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio);
    1.17        double marking_task_overhead =
    1.18 -        overall_cm_overhead / marking_thread_num *
    1.19 -                                                (double) os::processor_count();
    1.20 +        overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
    1.21        double sleep_factor =
    1.22                           (1.0 - marking_task_overhead) / marking_task_overhead;
    1.23  
     2.1 --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Thu Dec 15 19:48:32 2016 -0500
     2.2 +++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Thu Dec 15 20:00:01 2016 -0500
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -80,7 +80,7 @@
    2.11  
    2.12  // Determines how many mutator threads can process the buffers in parallel.
    2.13  uint DirtyCardQueueSet::num_par_ids() {
    2.14 -  return (uint)os::processor_count();
    2.15 +  return (uint)os::initial_active_processor_count();
    2.16  }
    2.17  
    2.18  void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
     3.1 --- a/src/share/vm/runtime/vm_version.cpp	Thu Dec 15 19:48:32 2016 -0500
     3.2 +++ b/src/share/vm/runtime/vm_version.cpp	Thu Dec 15 20:00:01 2016 -0500
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -296,7 +296,7 @@
    3.11      // processor after the first 8.  For example, on a 72 cpu machine
    3.12      // and a chosen fraction of 5/8
    3.13      // use 8 + (72 - 8) * (5/8) == 48 worker threads.
    3.14 -    unsigned int ncpus = (unsigned int) os::active_processor_count();
    3.15 +    unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
    3.16      return (ncpus <= switch_pt) ?
    3.17             ncpus :
    3.18            (switch_pt + ((ncpus - switch_pt) * num) / den);

mercurial