src/hotspot/share/gc/g1/heapRegionManager.cpp
changeset 59062 6530de931b8e
parent 59060 fce1fa1bdc91
child 59220 72e15d757e6c
equal deleted inserted replaced
59061:df6f2350edfa 59062:6530de931b8e
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "gc/g1/g1Arguments.hpp"
    26 #include "gc/g1/g1Arguments.hpp"
    27 #include "gc/g1/g1CollectedHeap.inline.hpp"
    27 #include "gc/g1/g1CollectedHeap.inline.hpp"
    28 #include "gc/g1/g1ConcurrentRefine.hpp"
    28 #include "gc/g1/g1ConcurrentRefine.hpp"
       
    29 #include "gc/g1/g1NUMAStats.hpp"
    29 #include "gc/g1/heapRegion.hpp"
    30 #include "gc/g1/heapRegion.hpp"
    30 #include "gc/g1/heapRegionManager.inline.hpp"
    31 #include "gc/g1/heapRegionManager.inline.hpp"
    31 #include "gc/g1/heapRegionSet.inline.hpp"
    32 #include "gc/g1/heapRegionSet.inline.hpp"
    32 #include "gc/g1/heterogeneousHeapRegionManager.hpp"
    33 #include "gc/g1/heterogeneousHeapRegionManager.hpp"
    33 #include "logging/logStream.hpp"
    34 #include "logging/logStream.hpp"
   105 }
   106 }
   106 
   107 
   107 HeapRegion* HeapRegionManager::allocate_free_region(HeapRegionType type, uint requested_node_index) {
   108 HeapRegion* HeapRegionManager::allocate_free_region(HeapRegionType type, uint requested_node_index) {
   108   HeapRegion* hr = NULL;
   109   HeapRegion* hr = NULL;
   109   bool from_head = !type.is_young();
   110   bool from_head = !type.is_young();
   110 
   111   G1NUMA* numa = G1NUMA::numa();
   111   if (requested_node_index != G1NUMA::AnyNodeIndex && G1NUMA::numa()->is_enabled()) {
   112 
       
   113   if (requested_node_index != G1NUMA::AnyNodeIndex && numa->is_enabled()) {
   112     // Try to allocate with requested node index.
   114     // Try to allocate with requested node index.
   113     hr = _free_list.remove_region_with_node_index(from_head, requested_node_index, NULL);
   115     hr = _free_list.remove_region_with_node_index(from_head, requested_node_index);
   114   }
   116   }
   115 
   117 
   116   if (hr == NULL) {
   118   if (hr == NULL) {
   117     // If there's a single active node or we did not get a region from our requested node,
   119     // If there's a single active node or we did not get a region from our requested node,
   118     // try without requested node index.
   120     // try without requested node index.
   120   }
   122   }
   121 
   123 
   122   if (hr != NULL) {
   124   if (hr != NULL) {
   123     assert(hr->next() == NULL, "Single region should not have next");
   125     assert(hr->next() == NULL, "Single region should not have next");
   124     assert(is_available(hr->hrm_index()), "Must be committed");
   126     assert(is_available(hr->hrm_index()), "Must be committed");
       
   127 
       
   128     if (numa->is_enabled() && hr->node_index() < numa->num_active_nodes()) {
       
   129       numa->update_statistics(G1NUMAStats::NewRegionAlloc, requested_node_index, hr->node_index());
       
   130     }
   125   }
   131   }
   126 
   132 
   127   return hr;
   133   return hr;
   128 }
   134 }
   129 
   135