Merge

Tue, 20 Dec 2016 08:57:29 +0000

author
zmajo
date
Tue, 20 Dec 2016 08:57:29 +0000
changeset 8667
dd67662d80a6
parent 8666
d3c2e95157e2
parent 8663
0c6912513be1
child 8668
c49daa7f447f

Merge

     1.1 --- a/src/os/windows/vm/os_windows.cpp	Mon Dec 19 08:31:01 2016 +0100
     1.2 +++ b/src/os/windows/vm/os_windows.cpp	Tue Dec 20 08:57:29 2016 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 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 @@ -1747,8 +1747,7 @@
    1.11      if (is_workstation) {
    1.12        st->print("10");
    1.13      } else {
    1.14 -      // The server version name of Windows 10 is not known at this time
    1.15 -      st->print("%d.%d", major_version, minor_version);
    1.16 +      st->print("Server 2016");
    1.17      }
    1.18      break;
    1.19  
     2.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Dec 19 08:31:01 2016 +0100
     2.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Dec 20 08:57:29 2016 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2001, 2014, 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 @@ -631,11 +631,10 @@
    2.11        double overall_cm_overhead =
    2.12          (double) MaxGCPauseMillis * marking_overhead /
    2.13          (double) GCPauseIntervalMillis;
    2.14 -      double cpu_ratio = 1.0 / (double) os::processor_count();
    2.15 +      double cpu_ratio = 1.0 / os::initial_active_processor_count();
    2.16        double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio);
    2.17        double marking_task_overhead =
    2.18 -        overall_cm_overhead / marking_thread_num *
    2.19 -                                                (double) os::processor_count();
    2.20 +        overall_cm_overhead / marking_thread_num * os::initial_active_processor_count();
    2.21        double sleep_factor =
    2.22                           (1.0 - marking_task_overhead) / marking_task_overhead;
    2.23  
     3.1 --- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Mon Dec 19 08:31:01 2016 +0100
     3.2 +++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Tue Dec 20 08:57:29 2016 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2001, 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 @@ -80,7 +80,7 @@
    3.11  
    3.12  // Determines how many mutator threads can process the buffers in parallel.
    3.13  uint DirtyCardQueueSet::num_par_ids() {
    3.14 -  return (uint)os::processor_count();
    3.15 +  return (uint)os::initial_active_processor_count();
    3.16  }
    3.17  
    3.18  void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
     4.1 --- a/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Mon Dec 19 08:31:01 2016 +0100
     4.2 +++ b/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Tue Dec 20 08:57:29 2016 +0000
     4.3 @@ -452,9 +452,13 @@
     4.4    // event lock and do the read again in case some other thread had already
     4.5    // succeeded and done the resize.
     4.6    int cur_collection = Universe::heap()->total_collections();
     4.7 -  if (_last_LNC_resizing_collection[i] != cur_collection) {
     4.8 +  // Updated _last_LNC_resizing_collection[i] must not be visible before
     4.9 +  // _lowest_non_clean and friends are visible. Therefore use acquire/release
    4.10 +  // to guarantee this on non TSO architecures.
    4.11 +  if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
    4.12      MutexLocker x(ParGCRareEvent_lock);
    4.13 -    if (_last_LNC_resizing_collection[i] != cur_collection) {
    4.14 +    // This load_acquire is here for clarity only. The MutexLocker already fences.
    4.15 +    if (OrderAccess::load_acquire(&_last_LNC_resizing_collection[i]) != cur_collection) {
    4.16        if (_lowest_non_clean[i] == NULL ||
    4.17            n_chunks != _lowest_non_clean_chunk_size[i]) {
    4.18  
    4.19 @@ -474,7 +478,8 @@
    4.20              _lowest_non_clean[i][j] = NULL;
    4.21          }
    4.22        }
    4.23 -      _last_LNC_resizing_collection[i] = cur_collection;
    4.24 +      // Make sure this gets visible only after _lowest_non_clean* was initialized
    4.25 +      OrderAccess::release_store(&_last_LNC_resizing_collection[i], cur_collection);
    4.26      }
    4.27    }
    4.28    // In any case, now do the initialization.
     5.1 --- a/src/share/vm/memory/cardTableModRefBS.hpp	Mon Dec 19 08:31:01 2016 +0100
     5.2 +++ b/src/share/vm/memory/cardTableModRefBS.hpp	Tue Dec 20 08:57:29 2016 +0000
     5.3 @@ -217,7 +217,7 @@
     5.4    CardArr* _lowest_non_clean;
     5.5    size_t*  _lowest_non_clean_chunk_size;
     5.6    uintptr_t* _lowest_non_clean_base_chunk_index;
     5.7 -  int* _last_LNC_resizing_collection;
     5.8 +  volatile int* _last_LNC_resizing_collection;
     5.9  
    5.10    // Initializes "lowest_non_clean" to point to the array for the region
    5.11    // covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk
     6.1 --- a/src/share/vm/runtime/os.cpp	Mon Dec 19 08:31:01 2016 +0100
     6.2 +++ b/src/share/vm/runtime/os.cpp	Tue Dec 20 08:57:29 2016 +0000
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -78,6 +78,7 @@
    6.11  uintptr_t         os::_serialize_page_mask = 0;
    6.12  long              os::_rand_seed          = 1;
    6.13  int               os::_processor_count    = 0;
    6.14 +int               os::_initial_active_processor_count = 0;
    6.15  size_t            os::_page_sizes[os::page_sizes_max];
    6.16  
    6.17  #ifndef PRODUCT
    6.18 @@ -322,6 +323,7 @@
    6.19  }
    6.20  
    6.21  void os::init_before_ergo() {
    6.22 +  initialize_initial_active_processor_count();
    6.23    // We need to initialize large page support here because ergonomics takes some
    6.24    // decisions depending on large page support and the calculated large page size.
    6.25    large_page_init();
    6.26 @@ -835,7 +837,11 @@
    6.27    st->print("CPU:");
    6.28    st->print("total %d", os::processor_count());
    6.29    // It's not safe to query number of active processors after crash
    6.30 -  // st->print("(active %d)", os::active_processor_count());
    6.31 +  // st->print("(active %d)", os::active_processor_count()); but we can
    6.32 +  // print the initial number of active processors.
    6.33 +  // We access the raw value here because the assert in the accessor will
    6.34 +  // fail if the crash occurs before initialization of this value.
    6.35 +  st->print(" (initial active %d)", _initial_active_processor_count);
    6.36    st->print(" %s", VM_Version::cpu_features());
    6.37    st->cr();
    6.38    pd_print_cpu_info(st);
    6.39 @@ -1418,6 +1424,11 @@
    6.40    return result;
    6.41  }
    6.42  
    6.43 +void os::initialize_initial_active_processor_count() {
    6.44 +  assert(_initial_active_processor_count == 0, "Initial active processor count already set.");
    6.45 +  _initial_active_processor_count = active_processor_count();
    6.46 +}
    6.47 +
    6.48  void os::SuspendedThreadTask::run() {
    6.49    assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this");
    6.50    internal_do_task();
     7.1 --- a/src/share/vm/runtime/os.hpp	Mon Dec 19 08:31:01 2016 +0100
     7.2 +++ b/src/share/vm/runtime/os.hpp	Tue Dec 20 08:57:29 2016 +0000
     7.3 @@ -151,6 +151,7 @@
     7.4  
     7.5    static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
     7.6  
     7.7 +  static void initialize_initial_active_processor_count();
     7.8   public:
     7.9    static void init(void);                      // Called before command line parsing
    7.10    static void init_before_ergo(void);          // Called after command line parsing
    7.11 @@ -238,6 +239,13 @@
    7.12    // Note that on some OSes this can change dynamically.
    7.13    static int active_processor_count();
    7.14  
    7.15 +  // At startup the number of active CPUs this process is allowed to run on.
    7.16 +  // This value does not change dynamically. May be different from active_processor_count().
    7.17 +  static int initial_active_processor_count() {
    7.18 +    assert(_initial_active_processor_count > 0, "Initial active processor count not set yet.");
    7.19 +    return _initial_active_processor_count;
    7.20 +  }
    7.21 +
    7.22    // Bind processes to processors.
    7.23    //     This is a two step procedure:
    7.24    //     first you generate a distribution of processes to processors,
    7.25 @@ -975,8 +983,9 @@
    7.26  
    7.27  
    7.28   protected:
    7.29 -  static long _rand_seed;                   // seed for random number generator
    7.30 -  static int _processor_count;              // number of processors
    7.31 +  static long _rand_seed;                     // seed for random number generator
    7.32 +  static int _processor_count;                // number of processors
    7.33 +  static int _initial_active_processor_count; // number of active processors during initialization.
    7.34  
    7.35    static char* format_boot_path(const char* format_string,
    7.36                                  const char* home,
     8.1 --- a/src/share/vm/runtime/vm_version.cpp	Mon Dec 19 08:31:01 2016 +0100
     8.2 +++ b/src/share/vm/runtime/vm_version.cpp	Tue Dec 20 08:57:29 2016 +0000
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -296,7 +296,7 @@
    8.11      // processor after the first 8.  For example, on a 72 cpu machine
    8.12      // and a chosen fraction of 5/8
    8.13      // use 8 + (72 - 8) * (5/8) == 48 worker threads.
    8.14 -    unsigned int ncpus = (unsigned int) os::active_processor_count();
    8.15 +    unsigned int ncpus = (unsigned int) os::initial_active_processor_count();
    8.16      return (ncpus <= switch_pt) ?
    8.17             ncpus :
    8.18            (switch_pt + ((ncpus - switch_pt) * num) / den);

mercurial