2994
2995 bool os::numa_topology_changed() { return false; }
2996
2997 size_t os::numa_get_groups_num() {
2998 // Return just the number of nodes in which it's possible to allocate memory
2999 // (in numa terminology, configured nodes).
3000 return Linux::numa_num_configured_nodes();
3001 }
3002
3003 int os::numa_get_group_id() {
3004 int cpu_id = Linux::sched_getcpu();
3005 if (cpu_id != -1) {
3006 int lgrp_id = Linux::get_node_by_cpu(cpu_id);
3007 if (lgrp_id != -1) {
3008 return lgrp_id;
3009 }
3010 }
3011 return 0;
3012 }
3013
3014 int os::Linux::get_existing_num_nodes() {
3015 int node;
3016 int highest_node_number = Linux::numa_max_node();
3017 int num_nodes = 0;
3018
3019 // Get the total number of nodes in the system including nodes without memory.
3020 for (node = 0; node <= highest_node_number; node++) {
3021 if (is_node_in_existing_nodes(node)) {
3022 num_nodes++;
3023 }
3024 }
3025 return num_nodes;
3026 }
3027
3028 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
3029 int highest_node_number = Linux::numa_max_node();
3030 size_t i = 0;
3031
3032 // Map all node ids in which it is possible to allocate memory. Also nodes are
3033 // not always consecutively available, i.e. available from 0 to the highest
|
2994
2995 bool os::numa_topology_changed() { return false; }
2996
2997 size_t os::numa_get_groups_num() {
2998 // Return just the number of nodes in which it's possible to allocate memory
2999 // (in numa terminology, configured nodes).
3000 return Linux::numa_num_configured_nodes();
3001 }
3002
3003 int os::numa_get_group_id() {
3004 int cpu_id = Linux::sched_getcpu();
3005 if (cpu_id != -1) {
3006 int lgrp_id = Linux::get_node_by_cpu(cpu_id);
3007 if (lgrp_id != -1) {
3008 return lgrp_id;
3009 }
3010 }
3011 return 0;
3012 }
3013
3014 int os::numa_get_address_id(void* address) {
3015 #ifndef MPOL_F_NODE
3016 #define MPOL_F_NODE (1<<0) // Return next IL mode instead of node mask
3017 #endif
3018
3019 #ifndef MPOL_F_ADDR
3020 #define MPOL_F_ADDR (1<<1) // Look up VMA using address
3021 #endif
3022
3023 int id = InvalidNUMAId;
3024
3025 if (syscall(SYS_get_mempolicy, &id, NULL, 0, address, MPOL_F_NODE | MPOL_F_ADDR) == -1) {
3026 warning("Failed to get numa id at " PTR_FORMAT " with errno=%d", p2i(address), errno);
3027 return InvalidNUMAId;
3028 }
3029 return id;
3030 }
3031
3032 int os::Linux::get_existing_num_nodes() {
3033 int node;
3034 int highest_node_number = Linux::numa_max_node();
3035 int num_nodes = 0;
3036
3037 // Get the total number of nodes in the system including nodes without memory.
3038 for (node = 0; node <= highest_node_number; node++) {
3039 if (is_node_in_existing_nodes(node)) {
3040 num_nodes++;
3041 }
3042 }
3043 return num_nodes;
3044 }
3045
3046 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
3047 int highest_node_number = Linux::numa_max_node();
3048 size_t i = 0;
3049
3050 // Map all node ids in which it is possible to allocate memory. Also nodes are
3051 // not always consecutively available, i.e. available from 0 to the highest
|