src/hotspot/share/gc/g1/heapRegionManager.cpp
changeset 59062 6530de931b8e
parent 59060 fce1fa1bdc91
child 59220 72e15d757e6c
--- a/src/hotspot/share/gc/g1/heapRegionManager.cpp	Wed Nov 13 10:49:32 2019 -0800
+++ b/src/hotspot/share/gc/g1/heapRegionManager.cpp	Wed Nov 13 10:51:41 2019 -0800
@@ -26,6 +26,7 @@
 #include "gc/g1/g1Arguments.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
+#include "gc/g1/g1NUMAStats.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegionManager.inline.hpp"
 #include "gc/g1/heapRegionSet.inline.hpp"
@@ -107,10 +108,11 @@
 HeapRegion* HeapRegionManager::allocate_free_region(HeapRegionType type, uint requested_node_index) {
   HeapRegion* hr = NULL;
   bool from_head = !type.is_young();
+  G1NUMA* numa = G1NUMA::numa();
 
-  if (requested_node_index != G1NUMA::AnyNodeIndex && G1NUMA::numa()->is_enabled()) {
+  if (requested_node_index != G1NUMA::AnyNodeIndex && numa->is_enabled()) {
     // Try to allocate with requested node index.
-    hr = _free_list.remove_region_with_node_index(from_head, requested_node_index, NULL);
+    hr = _free_list.remove_region_with_node_index(from_head, requested_node_index);
   }
 
   if (hr == NULL) {
@@ -122,6 +124,10 @@
   if (hr != NULL) {
     assert(hr->next() == NULL, "Single region should not have next");
     assert(is_available(hr->hrm_index()), "Must be committed");
+
+    if (numa->is_enabled() && hr->node_index() < numa->num_active_nodes()) {
+      numa->update_statistics(G1NUMAStats::NewRegionAlloc, requested_node_index, hr->node_index());
+    }
   }
 
   return hr;