8316098: Revise signature of numa_get_leaf_groups

Reviewed-by: tschatzl, coleenp
This commit is contained in:
Albert Mingkun Yang 2023-09-26 12:56:59 +00:00
parent 1513e7910f
commit e510dee162
7 changed files with 11 additions and 10 deletions
src/hotspot

@ -1911,7 +1911,7 @@ int os::numa_get_group_id() {
return 0;
}
size_t os::numa_get_leaf_groups(int *ids, size_t size) {
size_t os::numa_get_leaf_groups(uint *ids, size_t size) {
if (size > 0) {
ids[0] = 0;
return 1;

@ -1627,7 +1627,7 @@ int os::numa_get_group_id() {
return 0;
}
size_t os::numa_get_leaf_groups(int *ids, size_t size) {
size_t os::numa_get_leaf_groups(uint *ids, size_t size) {
if (size > 0) {
ids[0] = 0;
return 1;

@ -2959,7 +2959,7 @@ int os::Linux::get_existing_num_nodes() {
return num_nodes;
}
size_t os::numa_get_leaf_groups(int *ids, size_t size) {
size_t os::numa_get_leaf_groups(uint *ids, size_t size) {
int highest_node_number = Linux::numa_max_node();
size_t i = 0;
@ -2968,8 +2968,8 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) {
// node number. If the nodes have been bound explicitly using numactl membind,
// then allocate memory from those nodes only.
for (int node = 0; node <= highest_node_number; node++) {
if (Linux::is_node_in_bound_nodes((unsigned int)node)) {
ids[i++] = node;
if (Linux::is_node_in_bound_nodes(node)) {
ids[i++] = checked_cast<uint>(node);
}
}
return i;

@ -3838,7 +3838,7 @@ void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { }
bool os::numa_topology_changed() { return false; }
size_t os::numa_get_groups_num() { return MAX2(numa_node_list_holder.get_count(), 1); }
int os::numa_get_group_id() { return 0; }
size_t os::numa_get_leaf_groups(int *ids, size_t size) {
size_t os::numa_get_leaf_groups(uint *ids, size_t size) {
if (numa_node_list_holder.get_count() == 0 && size > 0) {
// Provide an answer for UMA systems
ids[0] = 0;
@ -3847,7 +3847,8 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) {
// check for size bigger than actual groups_num
size = MIN2(size, numa_get_groups_num());
for (int i = 0; i < (int)size; i++) {
ids[i] = numa_node_list_holder.get_node_list_entry(i);
int node_id = numa_node_list_holder.get_node_list_entry(i);
ids[i] = checked_cast<uint>(node_id);
}
return size;
}

@ -98,7 +98,7 @@ void G1NUMA::initialize(bool use_numa) {
// Create an array of active node ids.
_node_ids = NEW_C_HEAP_ARRAY(uint, num_node_ids, mtGC);
_num_active_node_ids = checked_cast<uint>(os::numa_get_leaf_groups(reinterpret_cast<int*>(_node_ids), num_node_ids));
_num_active_node_ids = checked_cast<uint>(os::numa_get_leaf_groups(_node_ids, num_node_ids));
uint max_node_id = 0;
for (uint i = 0; i < _num_active_node_ids; i++) {

@ -55,7 +55,7 @@ MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment),
size_t lgrp_limit = os::numa_get_groups_num();
uint *lgrp_ids = NEW_C_HEAP_ARRAY(uint, lgrp_limit, mtGC);
size_t lgrp_num = os::numa_get_leaf_groups(reinterpret_cast<int*>(lgrp_ids), lgrp_limit);
size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
assert(lgrp_num > 0, "There should be at least one locality group");
lgrp_spaces()->reserve(checked_cast<int>(lgrp_num));

@ -512,7 +512,7 @@ class os: AllStatic {
static void numa_make_local(char *addr, size_t bytes, int lgrp_hint);
static void numa_make_global(char *addr, size_t bytes);
static size_t numa_get_groups_num();
static size_t numa_get_leaf_groups(int *ids, size_t size);
static size_t numa_get_leaf_groups(uint *ids, size_t size);
static bool numa_topology_changed();
static int numa_get_group_id();
static int numa_get_group_id_for_address(const void* address);