src/os/linux/vm/os_linux.cpp

changeset 1198
cf71f149d7ae
parent 1196
622212a69394
child 1445
354d3184f6b2
     1.1 --- a/src/os/linux/vm/os_linux.cpp	Fri May 08 15:20:10 2009 -0700
     1.2 +++ b/src/os/linux/vm/os_linux.cpp	Tue May 12 15:55:56 2009 -0700
     1.3 @@ -2362,6 +2362,19 @@
     1.4  extern "C" void numa_warn(int number, char *where, ...) { }
     1.5  extern "C" void numa_error(char *where) { }
     1.6  
     1.7 +
     1.8 +// If we are running with libnuma version > 2, then we should
     1.9 +// be trying to use symbols with versions 1.1
    1.10 +// If we are running with earlier version, which did not have symbol versions,
    1.11 +// we should use the base version.
    1.12 +void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
    1.13 +  void *f = dlvsym(handle, name, "libnuma_1.1");
    1.14 +  if (f == NULL) {
    1.15 +    f = dlsym(handle, name);
    1.16 +  }
    1.17 +  return f;
    1.18 +}
    1.19 +
    1.20  bool os::Linux::libnuma_init() {
    1.21    // sched_getcpu() should be in libc.
    1.22    set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t,
    1.23 @@ -2371,19 +2384,19 @@
    1.24      void *handle = dlopen("libnuma.so.1", RTLD_LAZY);
    1.25      if (handle != NULL) {
    1.26        set_numa_node_to_cpus(CAST_TO_FN_PTR(numa_node_to_cpus_func_t,
    1.27 -                                           dlsym(handle, "numa_node_to_cpus")));
    1.28 +                                           libnuma_dlsym(handle, "numa_node_to_cpus")));
    1.29        set_numa_max_node(CAST_TO_FN_PTR(numa_max_node_func_t,
    1.30 -                                       dlsym(handle, "numa_max_node")));
    1.31 +                                       libnuma_dlsym(handle, "numa_max_node")));
    1.32        set_numa_available(CAST_TO_FN_PTR(numa_available_func_t,
    1.33 -                                        dlsym(handle, "numa_available")));
    1.34 +                                        libnuma_dlsym(handle, "numa_available")));
    1.35        set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t,
    1.36 -                                            dlsym(handle, "numa_tonode_memory")));
    1.37 +                                            libnuma_dlsym(handle, "numa_tonode_memory")));
    1.38        set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t,
    1.39 -                                            dlsym(handle, "numa_interleave_memory")));
    1.40 +                                            libnuma_dlsym(handle, "numa_interleave_memory")));
    1.41  
    1.42  
    1.43        if (numa_available() != -1) {
    1.44 -        set_numa_all_nodes((unsigned long*)dlsym(handle, "numa_all_nodes"));
    1.45 +        set_numa_all_nodes((unsigned long*)libnuma_dlsym(handle, "numa_all_nodes"));
    1.46          // Create a cpu -> node mapping
    1.47          _cpu_to_node = new (ResourceObj::C_HEAP) GrowableArray<int>(0, true);
    1.48          rebuild_cpu_to_node_map();

mercurial