]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Fix allocator handling for Linux when libnuma is not available
authorTobias Burnus <tobias@codesourcery.com>
Fri, 14 Jul 2023 07:14:37 +0000 (09:14 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Fri, 14 Jul 2023 07:19:57 +0000 (09:19 +0200)
Follow up to r14-2462-g450b05ce54d3f0.  The case that libnuma was not
available at runtime was not properly handled; now it falls back to
the normal malloc.

libgomp/

* allocator.c (omp_init_allocator): Check whether symbol from
dlopened libnuma is available before using libnuma for
allocations.

libgomp/allocator.c

index b3187ab2911f66a83fe261c4307e41795d7c332f..90f2dcb60d64b97d68a8280d58cc82587ba5370a 100644 (file)
@@ -377,8 +377,9 @@ omp_init_allocator (omp_memspace_handle_t memspace, int ntraits,
 #ifdef LIBGOMP_USE_LIBNUMA
   if (data.memkind == GOMP_MEMKIND_NONE && data.partition == omp_atv_nearest)
     {
-      data.memkind = GOMP_MEMKIND_LIBNUMA;
       libnuma_data = gomp_get_libnuma ();
+      if (libnuma_data->numa_alloc_local != NULL)
+       data.memkind = GOMP_MEMKIND_LIBNUMA;
     }
 #endif