src/hotspot/share/gc/g1/g1RegionsOnNodes.hpp
author sangheki
Wed, 13 Nov 2019 10:51:41 -0800
changeset 59062 6530de931b8e
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:
59062
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     1
/*
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     4
 *
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     8
 *
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    13
 * accompanied this code).
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    14
 *
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    18
 *
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    21
 * questions.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    22
 *
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    23
 */
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    24
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1REGIONS_HPP
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    26
#define SHARE_VM_GC_G1_G1REGIONS_HPP
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    27
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    28
#include "memory/allocation.hpp"
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    29
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    30
class G1NUMA;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    31
class HeapRegion;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    32
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    33
// Contains per node index region count
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    34
class G1RegionsOnNodes : public StackObj {
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    35
  volatile uint* _count_per_node;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    36
  G1NUMA*        _numa;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    37
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    38
public:
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    39
  G1RegionsOnNodes();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    40
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    41
  ~G1RegionsOnNodes();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    42
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    43
  // Increase _count_per_node for the node of given heap region and returns node index.
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    44
  uint add(HeapRegion* hr);
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    45
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    46
  void clear();
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    47
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    48
  uint count(uint node_index) const;
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    49
};
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    50
6530de931b8e 8220312: Implementation: NUMA-Aware Memory Allocation for G1, Logging (3/3)
sangheki
parents:
diff changeset
    51
#endif // SHARE_VM_GC_G1_G1REGIONS_HPP