src/hotspot/os/linux/os_linux.cpp
changeset 59060 fce1fa1bdc91
parent 59016 3b9eeae66fa0
child 59062 6530de931b8e
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Nov 13 13:43:06 2019 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp	Wed Nov 13 10:49:12 2019 -0800
@@ -3007,6 +3007,23 @@
   return 0;
 }
 
+int os::numa_get_group_id_for_address(const void* address) {
+#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
+
+  int id = 0;
+
+  if (syscall(SYS_get_mempolicy, &id, NULL, 0, const_cast<void*>(address), MPOL_F_NODE | MPOL_F_ADDR) == -1) {
+    return -1;
+  }
+  return id;
+}
+
 int os::Linux::get_existing_num_nodes() {
   int node;
   int highest_node_number = Linux::numa_max_node();