src/hotspot/share/gc/g1/g1NUMA.hpp
author sangheki
Wed, 13 Nov 2019 10:51:41 -0800
changeset 59062 6530de931b8e
parent 59060 fce1fa1bdc91
permissions -rw-r--r--
8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3) Reviewed-by: kbarrett, sjohanss, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     1
/*
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     4
 *
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     8
 *
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    13
 * accompanied this code).
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    14
 *
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    18
 *
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    21
 * questions.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    22
 *
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    23
 */
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    24
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    25
#ifndef SHARE_VM_GC_G1_NUMA_HPP
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    26
#define SHARE_VM_GC_G1_NUMA_HPP
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    27
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    28
#include "gc/g1/g1NUMAStats.hpp"
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    29
#include "gc/g1/heapRegion.hpp"
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    30
#include "memory/allocation.hpp"
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    31
#include "runtime/os.hpp"
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    32
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    33
class LogStream;
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    34
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    35
class G1NUMA: public CHeapObj<mtGC> {
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    36
  // Mapping of available node ids to  0-based index which can be used for
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    37
  // fast resource management. I.e. for every node id provides a unique value in
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    38
  // the range from [0, {# of nodes-1}].
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    39
  // For invalid node id, return UnknownNodeIndex.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    40
  uint* _node_id_to_index_map;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    41
  // Length of _num_active_node_ids_id to index map.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    42
  int _len_node_id_to_index_map;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    43
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    44
  // Current active node ids.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    45
  int* _node_ids;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    46
  // Total number of node ids.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    47
  uint _num_active_node_ids;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    48
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    49
  // HeapRegion size
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    50
  size_t _region_size;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    51
  // Necessary when touching memory.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    52
  size_t _page_size;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    53
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    54
  // Stores statistic data.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    55
  G1NUMAStats* _stats;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
    56
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    57
  size_t region_size() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    58
  size_t page_size() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    59
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    60
  // Returns node index of the given node id.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    61
  // Precondition: node_id is an active node id.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    62
  inline uint index_of_node_id(int node_id) const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    63
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    64
  // Creates node id and node index mapping table of _node_id_to_index_map.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    65
  void init_node_id_to_index_map(const int* node_ids, uint num_node_ids);
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    66
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    67
  static G1NUMA* _inst;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    68
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    69
  G1NUMA();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    70
  void initialize(bool use_numa);
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    71
  void initialize_without_numa();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    72
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    73
public:
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    74
  static const uint UnknownNodeIndex = UINT_MAX;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    75
  static const uint AnyNodeIndex = UnknownNodeIndex - 1;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    76
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    77
  static G1NUMA* numa() { return _inst; }
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    78
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    79
  static G1NUMA* create();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    80
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    81
  ~G1NUMA();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    82
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    83
  // Sets heap region size and page size after those values
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    84
  // are determined at G1CollectedHeap::initialize().
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    85
  void set_region_info(size_t region_size, size_t page_size);
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    86
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    87
  // Returns active memory node count.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    88
  uint num_active_nodes() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    89
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    90
  bool is_enabled() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    91
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    92
  int numa_id(int index) const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    93
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    94
  // Returns memory node ids
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    95
  const int* node_ids() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    96
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    97
  // Returns node index of current calling thread.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    98
  uint index_of_current_thread() const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
    99
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   100
  // Returns the preferred index for the given HeapRegion index.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   101
  // This assumes that HeapRegions are evenly spit, so we can decide preferred index
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   102
  // with the given HeapRegion index.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   103
  // Result is less than num_active_nodes().
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   104
  uint preferred_node_index_for_index(uint region_index) const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   105
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   106
  // Retrieves node index of the given address.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   107
  // Result is less than num_active_nodes() or is UnknownNodeIndex.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   108
  // Precondition: address is in reserved range for heap.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   109
  uint index_of_address(HeapWord* address) const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   110
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   111
  // If AlwaysPreTouch is enabled, return actual node index via system call.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   112
  // If disabled, return preferred node index of the given heap region.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   113
  uint index_for_region(HeapRegion* hr) const;
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   114
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   115
  // Requests the given memory area to be located at the given node index.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   116
  void request_memory_on_node(void* aligned_address, size_t size_in_bytes, uint region_index);
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   117
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   118
  // Returns maximum search depth which is used to limit heap region search iterations.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   119
  // The number of active nodes, page size and heap region size are considered.
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   120
  uint max_search_depth() const;
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   121
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   122
  // Update the given phase of requested and allocated node index.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   123
  void update_statistics(G1NUMAStats::NodeDataItems phase, uint requested_node_index, uint allocated_node_index);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   124
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   125
  // Copy all allocated statistics of the given phase and requested node.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   126
  // Precondition: allocated_stat should have same length of active nodes.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   127
  void copy_statistics(G1NUMAStats::NodeDataItems phase, uint requested_node_index, size_t* allocated_stat);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   128
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   129
  // Print all statistics.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   130
  void print_statistics() const;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   131
};
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   132
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   133
class G1NodeIndexCheckClosure : public HeapRegionClosure {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   134
  const char* _desc;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   135
  G1NUMA* _numa;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   136
  // Records matched count of each node.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   137
  uint* _matched;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   138
  // Records mismatched count of each node.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   139
  uint* _mismatched;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   140
  // Records total count of each node.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   141
  // Total = matched + mismatched + unknown.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   142
  uint* _total;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   143
  LogStream* _ls;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   144
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   145
public:
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   146
  G1NodeIndexCheckClosure(const char* desc, G1NUMA* numa, LogStream* ls);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   147
  ~G1NodeIndexCheckClosure();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   148
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents: 59060
diff changeset
   149
  bool do_heap_region(HeapRegion* hr);
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   150
};
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   151
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents:
diff changeset
   152
#endif // SHARE_VM_GC_G1_NUMA_HPP