1.1 --- a/src/share/vm/runtime/os.cpp Fri Oct 28 22:36:23 2016 +0000 1.2 +++ b/src/share/vm/runtime/os.cpp Thu Dec 15 19:48:32 2016 -0500 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 @@ -78,6 +78,7 @@ 1.11 uintptr_t os::_serialize_page_mask = 0; 1.12 long os::_rand_seed = 1; 1.13 int os::_processor_count = 0; 1.14 +int os::_initial_active_processor_count = 0; 1.15 size_t os::_page_sizes[os::page_sizes_max]; 1.16 1.17 #ifndef PRODUCT 1.18 @@ -322,6 +323,7 @@ 1.19 } 1.20 1.21 void os::init_before_ergo() { 1.22 + initialize_initial_active_processor_count(); 1.23 // We need to initialize large page support here because ergonomics takes some 1.24 // decisions depending on large page support and the calculated large page size. 1.25 large_page_init(); 1.26 @@ -835,7 +837,11 @@ 1.27 st->print("CPU:"); 1.28 st->print("total %d", os::processor_count()); 1.29 // It's not safe to query number of active processors after crash 1.30 - // st->print("(active %d)", os::active_processor_count()); 1.31 + // st->print("(active %d)", os::active_processor_count()); but we can 1.32 + // print the initial number of active processors. 1.33 + // We access the raw value here because the assert in the accessor will 1.34 + // fail if the crash occurs before initialization of this value. 1.35 + st->print(" (initial active %d)", _initial_active_processor_count); 1.36 st->print(" %s", VM_Version::cpu_features()); 1.37 st->cr(); 1.38 pd_print_cpu_info(st); 1.39 @@ -1418,6 +1424,11 @@ 1.40 return result; 1.41 } 1.42 1.43 +void os::initialize_initial_active_processor_count() { 1.44 + assert(_initial_active_processor_count == 0, "Initial active processor count already set."); 1.45 + _initial_active_processor_count = active_processor_count(); 1.46 +} 1.47 + 1.48 void os::SuspendedThreadTask::run() { 1.49 assert(Threads_lock->owned_by_self() || (_thread == VMThread::vm_thread()), "must have threads lock to call this"); 1.50 internal_do_task();