X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=libringbuffer%2Fshm.c;h=0153578c93a2cfddf3bdd69ae57324b516086651;hb=bfcda6cea270952898ea122c375f2ed19105adef;hp=135a2007b0e780221a0aa3cddeffe528a6e54733;hpb=4b68c31f1859175d2bd4e1b42f1b7d301e84760f;p=lttng-ust.git diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 135a2007..0153578c 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -19,6 +19,7 @@ */ #define _LGPL_SOURCE +#include #include "shm.h" #include #include @@ -32,7 +33,9 @@ #include #include #include +#ifdef HAVE_LIBNUMA #include +#endif #include #include @@ -247,8 +250,9 @@ struct shm_object *shm_object_table_alloc(struct shm_object_table *table, int stream_fd, int cpu) { - int oldnode, node; struct shm_object *shm_object; +#ifdef HAVE_LIBNUMA + int oldnode, node; oldnode = numa_preferred(); if (cpu >= 0) { @@ -258,6 +262,7 @@ struct shm_object *shm_object_table_alloc(struct shm_object_table *table, } if (cpu < 0 || node < 0) numa_set_localalloc(); +#endif /* HAVE_LIBNUMA */ switch (type) { case SHM_OBJECT_SHM: shm_object = _shm_object_table_alloc_shm(table, memory_map_size, @@ -269,7 +274,9 @@ struct shm_object *shm_object_table_alloc(struct shm_object_table *table, default: assert(0); } +#ifdef HAVE_LIBNUMA numa_set_preferred(oldnode); +#endif /* HAVE_LIBNUMA */ return shm_object; }