< prev index next >

src/hotspot/os/linux/os_linux.hpp

Print this page
rev 49214 : 8198794: Hotspot crash on Cassandra 3.11.1 startup with libnuma 2.0.3


 241   static numa_interleave_memory_v2_func_t _numa_interleave_memory_v2;
 242   static numa_set_bind_policy_func_t _numa_set_bind_policy;
 243   static numa_bitmask_isbitset_func_t _numa_bitmask_isbitset;
 244   static numa_distance_func_t _numa_distance;
 245   static unsigned long* _numa_all_nodes;
 246   static struct bitmask* _numa_all_nodes_ptr;
 247   static struct bitmask* _numa_nodes_ptr;
 248 
 249   static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; }
 250   static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; }
 251   static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; }
 252   static void set_numa_num_configured_nodes(numa_num_configured_nodes_func_t func) { _numa_num_configured_nodes = func; }
 253   static void set_numa_available(numa_available_func_t func) { _numa_available = func; }
 254   static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; }
 255   static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; }
 256   static void set_numa_interleave_memory_v2(numa_interleave_memory_v2_func_t func) { _numa_interleave_memory_v2 = func; }
 257   static void set_numa_set_bind_policy(numa_set_bind_policy_func_t func) { _numa_set_bind_policy = func; }
 258   static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
 259   static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
 260   static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; }
 261   static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = *ptr; }
 262   static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = *ptr; }
 263   static int sched_getcpu_syscall(void);
 264  public:
 265   static int sched_getcpu()  { return _sched_getcpu != NULL ? _sched_getcpu() : -1; }
 266   static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) {
 267     return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1;
 268   }
 269   static int numa_max_node() { return _numa_max_node != NULL ? _numa_max_node() : -1; }
 270   static int numa_num_configured_nodes() {
 271     return _numa_num_configured_nodes != NULL ? _numa_num_configured_nodes() : -1;
 272   }
 273   static int numa_available() { return _numa_available != NULL ? _numa_available() : -1; }
 274   static int numa_tonode_memory(void *start, size_t size, int node) {
 275     return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1;
 276   }
 277   static void numa_interleave_memory(void *start, size_t size) {
 278     // Use v2 api if available
 279     if (_numa_interleave_memory_v2 != NULL && _numa_all_nodes_ptr != NULL) {
 280       _numa_interleave_memory_v2(start, size, _numa_all_nodes_ptr);
 281     } else if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) {
 282       _numa_interleave_memory(start, size, _numa_all_nodes);


 286     if (_numa_set_bind_policy != NULL) {
 287       _numa_set_bind_policy(policy);
 288     }
 289   }
 290   static int numa_distance(int node1, int node2) {
 291     return _numa_distance != NULL ? _numa_distance(node1, node2) : -1;
 292   }
 293   static int get_node_by_cpu(int cpu_id);
 294   static int get_existing_num_nodes();
 295   // Check if numa node is configured (non-zero memory node).
 296   static bool isnode_in_configured_nodes(unsigned int n) {
 297     if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) {
 298       return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
 299     } else
 300       return 0;
 301   }
 302   // Check if numa node exists in the system (including zero memory nodes).
 303   static bool isnode_in_existing_nodes(unsigned int n) {
 304     if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) {
 305       return _numa_bitmask_isbitset(_numa_nodes_ptr, n);












 306     } else
 307       return 0;
 308   }
 309 };
 310 
 311 #endif // OS_LINUX_VM_OS_LINUX_HPP


 241   static numa_interleave_memory_v2_func_t _numa_interleave_memory_v2;
 242   static numa_set_bind_policy_func_t _numa_set_bind_policy;
 243   static numa_bitmask_isbitset_func_t _numa_bitmask_isbitset;
 244   static numa_distance_func_t _numa_distance;
 245   static unsigned long* _numa_all_nodes;
 246   static struct bitmask* _numa_all_nodes_ptr;
 247   static struct bitmask* _numa_nodes_ptr;
 248 
 249   static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; }
 250   static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; }
 251   static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; }
 252   static void set_numa_num_configured_nodes(numa_num_configured_nodes_func_t func) { _numa_num_configured_nodes = func; }
 253   static void set_numa_available(numa_available_func_t func) { _numa_available = func; }
 254   static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; }
 255   static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; }
 256   static void set_numa_interleave_memory_v2(numa_interleave_memory_v2_func_t func) { _numa_interleave_memory_v2 = func; }
 257   static void set_numa_set_bind_policy(numa_set_bind_policy_func_t func) { _numa_set_bind_policy = func; }
 258   static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
 259   static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
 260   static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; }
 261   static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
 262   static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
 263   static int sched_getcpu_syscall(void);
 264  public:
 265   static int sched_getcpu()  { return _sched_getcpu != NULL ? _sched_getcpu() : -1; }
 266   static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) {
 267     return _numa_node_to_cpus != NULL ? _numa_node_to_cpus(node, buffer, bufferlen) : -1;
 268   }
 269   static int numa_max_node() { return _numa_max_node != NULL ? _numa_max_node() : -1; }
 270   static int numa_num_configured_nodes() {
 271     return _numa_num_configured_nodes != NULL ? _numa_num_configured_nodes() : -1;
 272   }
 273   static int numa_available() { return _numa_available != NULL ? _numa_available() : -1; }
 274   static int numa_tonode_memory(void *start, size_t size, int node) {
 275     return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1;
 276   }
 277   static void numa_interleave_memory(void *start, size_t size) {
 278     // Use v2 api if available
 279     if (_numa_interleave_memory_v2 != NULL && _numa_all_nodes_ptr != NULL) {
 280       _numa_interleave_memory_v2(start, size, _numa_all_nodes_ptr);
 281     } else if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) {
 282       _numa_interleave_memory(start, size, _numa_all_nodes);


 286     if (_numa_set_bind_policy != NULL) {
 287       _numa_set_bind_policy(policy);
 288     }
 289   }
 290   static int numa_distance(int node1, int node2) {
 291     return _numa_distance != NULL ? _numa_distance(node1, node2) : -1;
 292   }
 293   static int get_node_by_cpu(int cpu_id);
 294   static int get_existing_num_nodes();
 295   // Check if numa node is configured (non-zero memory node).
 296   static bool isnode_in_configured_nodes(unsigned int n) {
 297     if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) {
 298       return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
 299     } else
 300       return 0;
 301   }
 302   // Check if numa node exists in the system (including zero memory nodes).
 303   static bool isnode_in_existing_nodes(unsigned int n) {
 304     if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) {
 305       return _numa_bitmask_isbitset(_numa_nodes_ptr, n);
 306     } else if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) {
 307       // Not all libnuma API v2 implement numa_nodes_ptr, so it's not possible
 308       // to trust the API version for checking its absence. On the other hand,
 309       // numa_nodes_ptr found in libnuma 2.0.9 and above is the only way to get
 310       // a complete view of all numa nodes in the system, hence numa_nodes_ptr
 311       // is used to handle CPU and nodes on architectures (like PowerPC) where
 312       // there can exist nodes with CPUs but no memory or vice-versa and the
 313       // nodes may be non-contiguous. For most of the architectures, like
 314       // x86_64, numa_node_ptr presents the same node set as found in
 315       // numa_all_nodes_ptr so it's possible to use numa_all_nodes_ptr as a
 316       // substitute.
 317       return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
 318     } else
 319       return 0;
 320   }
 321 };
 322 
 323 #endif // OS_LINUX_VM_OS_LINUX_HPP
< prev index next >