< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 56448 : imported patch 8220310.mut.0
rev 56449 : imported patch 8220310.mut.1
rev 56451 : imported patch 8220310.mut.3
rev 56452 : [mq]: 8220310.mut.4
rev 56453 : [mq]: 8220310.mut.5

@@ -3009,10 +3009,28 @@
     }
   }
   return 0;
 }
 
+int os::numa_get_address_id(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 = InvalidNUMAId;
+
+  if (syscall(SYS_get_mempolicy, &id, NULL, 0, address, MPOL_F_NODE | MPOL_F_ADDR) == -1) {
+    warning("Failed to get numa id at " PTR_FORMAT " with errno=%d", p2i(address), errno);
+    return InvalidNUMAId;
+  }
+  return id;
+}
+
 int os::Linux::get_existing_num_nodes() {
   int node;
   int highest_node_number = Linux::numa_max_node();
   int num_nodes = 0;
 
< prev index next >