2817 // Something to do with the numa-aware allocator needs these symbols |
2817 // Something to do with the numa-aware allocator needs these symbols |
2818 extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } |
2818 extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } |
2819 extern "C" JNIEXPORT void numa_error(char *where) { } |
2819 extern "C" JNIEXPORT void numa_error(char *where) { } |
2820 extern "C" JNIEXPORT int fork1() { return fork(); } |
2820 extern "C" JNIEXPORT int fork1() { return fork(); } |
2821 |
2821 |
2822 |
2822 // Handle request to load libnuma symbol version 1.1 (API v1). If it fails |
2823 // If we are running with libnuma version > 2, then we should |
2823 // load symbol from base version instead. |
2824 // be trying to use symbols with versions 1.1 |
|
2825 // If we are running with earlier version, which did not have symbol versions, |
|
2826 // we should use the base version. |
|
2827 void* os::Linux::libnuma_dlsym(void* handle, const char *name) { |
2824 void* os::Linux::libnuma_dlsym(void* handle, const char *name) { |
2828 void *f = dlvsym(handle, name, "libnuma_1.1"); |
2825 void *f = dlvsym(handle, name, "libnuma_1.1"); |
2829 if (f == NULL) { |
2826 if (f == NULL) { |
2830 f = dlsym(handle, name); |
2827 f = dlsym(handle, name); |
2831 } |
2828 } |
2832 return f; |
2829 return f; |
|
2830 } |
|
2831 |
|
2832 // Handle request to load libnuma symbol version 1.2 (API v2) only. |
|
2833 // Return NULL if the symbol is not defined in this particular version. |
|
2834 void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) { |
|
2835 return dlvsym(handle, name, "libnuma_1.2"); |
2833 } |
2836 } |
2834 |
2837 |
2835 bool os::Linux::libnuma_init() { |
2838 bool os::Linux::libnuma_init() { |
2836 // sched_getcpu() should be in libc. |
2839 // sched_getcpu() should be in libc. |
2837 set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, |
2840 set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, |
2854 libnuma_dlsym(handle, "numa_available"))); |
2857 libnuma_dlsym(handle, "numa_available"))); |
2855 set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, |
2858 set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, |
2856 libnuma_dlsym(handle, "numa_tonode_memory"))); |
2859 libnuma_dlsym(handle, "numa_tonode_memory"))); |
2857 set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, |
2860 set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, |
2858 libnuma_dlsym(handle, "numa_interleave_memory"))); |
2861 libnuma_dlsym(handle, "numa_interleave_memory"))); |
|
2862 set_numa_interleave_memory_v2(CAST_TO_FN_PTR(numa_interleave_memory_v2_func_t, |
|
2863 libnuma_v2_dlsym(handle, "numa_interleave_memory"))); |
2859 set_numa_set_bind_policy(CAST_TO_FN_PTR(numa_set_bind_policy_func_t, |
2864 set_numa_set_bind_policy(CAST_TO_FN_PTR(numa_set_bind_policy_func_t, |
2860 libnuma_dlsym(handle, "numa_set_bind_policy"))); |
2865 libnuma_dlsym(handle, "numa_set_bind_policy"))); |
2861 set_numa_bitmask_isbitset(CAST_TO_FN_PTR(numa_bitmask_isbitset_func_t, |
2866 set_numa_bitmask_isbitset(CAST_TO_FN_PTR(numa_bitmask_isbitset_func_t, |
2862 libnuma_dlsym(handle, "numa_bitmask_isbitset"))); |
2867 libnuma_dlsym(handle, "numa_bitmask_isbitset"))); |
2863 set_numa_distance(CAST_TO_FN_PTR(numa_distance_func_t, |
2868 set_numa_distance(CAST_TO_FN_PTR(numa_distance_func_t, |
2973 os::Linux::numa_max_node_func_t os::Linux::_numa_max_node; |
2978 os::Linux::numa_max_node_func_t os::Linux::_numa_max_node; |
2974 os::Linux::numa_num_configured_nodes_func_t os::Linux::_numa_num_configured_nodes; |
2979 os::Linux::numa_num_configured_nodes_func_t os::Linux::_numa_num_configured_nodes; |
2975 os::Linux::numa_available_func_t os::Linux::_numa_available; |
2980 os::Linux::numa_available_func_t os::Linux::_numa_available; |
2976 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory; |
2981 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory; |
2977 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory; |
2982 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory; |
|
2983 os::Linux::numa_interleave_memory_v2_func_t os::Linux::_numa_interleave_memory_v2; |
2978 os::Linux::numa_set_bind_policy_func_t os::Linux::_numa_set_bind_policy; |
2984 os::Linux::numa_set_bind_policy_func_t os::Linux::_numa_set_bind_policy; |
2979 os::Linux::numa_bitmask_isbitset_func_t os::Linux::_numa_bitmask_isbitset; |
2985 os::Linux::numa_bitmask_isbitset_func_t os::Linux::_numa_bitmask_isbitset; |
2980 os::Linux::numa_distance_func_t os::Linux::_numa_distance; |
2986 os::Linux::numa_distance_func_t os::Linux::_numa_distance; |
2981 unsigned long* os::Linux::_numa_all_nodes; |
2987 unsigned long* os::Linux::_numa_all_nodes; |
2982 struct bitmask* os::Linux::_numa_all_nodes_ptr; |
2988 struct bitmask* os::Linux::_numa_all_nodes_ptr; |