JDK-8147907 : safepoint use of processor_count()
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Not an Issue
  • Submitted: 2016-01-21
  • Updated: 2016-01-25
  • Resolved: 2016-01-25
Description
With regard to the umbrella task JDK-8147905 please verify the use of processor_count() in the safepoint code:

./share/vm/runtime/safepoint.cpp:  int ncpus = os::processor_count() ;

Comments
The code is: // Consider using active_processor_count() ... but that call is expensive. int ncpus = os::processor_count() ; ... // 8. Consider making the spin duration a function of the # of CPUs: // Spin = (((ncpus-1) * M) + K) + F(still_running) ... // Instead of (ncpus > 1) consider either (still_running < (ncpus + EPSILON)) or // ((still_running + _waiting_to_block - TryingToBlock)) < ncpus) ++steps; if (ncpus > 1 && steps < SafepointSpinBeforeYield) { SpinPause() ; // MP-Polite spin } else As we only actually end up testing for > 1 the only case this would be wrong would be if the VM were constrained to a single processor. Even then this would not be a correctness issue as this is just a spinning heuristic. So the use of processor_count() here is not an issue.
25-01-2016