--- old/src/hotspot/os/linux/os_linux.cpp 2019-09-30 17:12:52.484030049 -0700 +++ new/src/hotspot/os/linux/os_linux.cpp 2019-09-30 17:12:52.120030062 -0700 @@ -3011,6 +3011,24 @@ return 0; } +int os::numa_get_address_id(uintptr_t addr) { +#ifndef MPOL_F_NODE +#define MPOL_F_NODE (1<<0) // Return next IL mode instead of node mask +#endif + +#ifndef MPOL_F_ADDR +#define MPOL_F_ADDR (1<<1) // Look up VMA using address +#endif + + uint32_t id = (uint32_t)-1; + + if (syscall(SYS_get_mempolicy, &id, NULL, 0, addr, MPOL_F_NODE | MPOL_F_ADDR) == -1) { + warning("Failed to get numa id at " PTR_FORMAT " with errno=%d", p2i((void*)addr), errno); + return os::InvalidId; + } + return id; +} + int os::Linux::get_existing_num_nodes() { int node; int highest_node_number = Linux::numa_max_node();