8198794: Hotspot crash on Cassandra 3.11.1 startup with libnuma 2.0.3

Thu, 22 Mar 2018 21:47:01 -0400

author
gromero
date
Thu, 22 Mar 2018 21:47:01 -0400
changeset 9182
0f31f18d2241
parent 9181
e54bf58b34b3
child 9183
f95c67788f18

8198794: Hotspot crash on Cassandra 3.11.1 startup with libnuma 2.0.3
Reviewed-by: dholmes, phh

src/os/linux/vm/os_linux.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/os/linux/vm/os_linux.hpp	Fri Mar 16 15:48:15 2018 +0100
     1.2 +++ b/src/os/linux/vm/os_linux.hpp	Thu Mar 22 21:47:01 2018 -0400
     1.3 @@ -285,8 +285,8 @@
     1.4    static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
     1.5    static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
     1.6    static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; }
     1.7 -  static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = *ptr; }
     1.8 -  static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = *ptr; }
     1.9 +  static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
    1.10 +  static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
    1.11    static int sched_getcpu_syscall(void);
    1.12  public:
    1.13    static int sched_getcpu()  { return _sched_getcpu != NULL ? _sched_getcpu() : -1; }
    1.14 @@ -330,6 +330,18 @@
    1.15    static bool isnode_in_existing_nodes(unsigned int n) {
    1.16      if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) {
    1.17        return _numa_bitmask_isbitset(_numa_nodes_ptr, n);
    1.18 +    } else if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) {
    1.19 +      // Not all libnuma API v2 implement numa_nodes_ptr, so it's not possible
    1.20 +      // to trust the API version for checking its absence. On the other hand,
    1.21 +      // numa_nodes_ptr found in libnuma 2.0.9 and above is the only way to get
    1.22 +      // a complete view of all numa nodes in the system, hence numa_nodes_ptr
    1.23 +      // is used to handle CPU and nodes on architectures (like PowerPC) where
    1.24 +      // there can exist nodes with CPUs but no memory or vice-versa and the
    1.25 +      // nodes may be non-contiguous. For most of the architectures, like
    1.26 +      // x86_64, numa_node_ptr presents the same node set as found in
    1.27 +      // numa_all_nodes_ptr so it's possible to use numa_all_nodes_ptr as a
    1.28 +      // substitute.
    1.29 +      return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
    1.30      } else
    1.31        return 0;
    1.32    }

mercurial