projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Take NUMA configuration into account for UST buffer allocation
[lttng-ust.git]
/
libringbuffer
/
shm.c
diff --git
a/libringbuffer/shm.c
b/libringbuffer/shm.c
index ea946ea3f5e2a6d2e46d3297ebe925135164272e..135a2007b0e780221a0aa3cddeffe528a6e54733 100644
(file)
--- a/
libringbuffer/shm.c
+++ b/
libringbuffer/shm.c
@@
-32,6
+32,7
@@
#include <dirent.h>
#include <lttng/align.h>
#include <limits.h>
#include <dirent.h>
#include <lttng/align.h>
#include <limits.h>
+#include <numa.h>
#include <helper.h>
#include <ust-fd.h>
#include <helper.h>
#include <ust-fd.h>
@@
-243,18
+244,33
@@
alloc_error:
struct shm_object *shm_object_table_alloc(struct shm_object_table *table,
size_t memory_map_size,
enum shm_object_type type,
struct shm_object *shm_object_table_alloc(struct shm_object_table *table,
size_t memory_map_size,
enum shm_object_type type,
- int stream_fd)
+ int stream_fd,
+ int cpu)
{
{
+ int oldnode, node;
+ struct shm_object *shm_object;
+
+ oldnode = numa_preferred();
+ if (cpu >= 0) {
+ node = numa_node_of_cpu(cpu);
+ if (node >= 0)
+ numa_set_preferred(node);
+ }
+ if (cpu < 0 || node < 0)
+ numa_set_localalloc();
switch (type) {
case SHM_OBJECT_SHM:
switch (type) {
case SHM_OBJECT_SHM:
-
return
_shm_object_table_alloc_shm(table, memory_map_size,
+
shm_object =
_shm_object_table_alloc_shm(table, memory_map_size,
stream_fd);
stream_fd);
+ break;
case SHM_OBJECT_MEM:
case SHM_OBJECT_MEM:
- return _shm_object_table_alloc_mem(table, memory_map_size);
+ shm_object = _shm_object_table_alloc_mem(table, memory_map_size);
+ break;
default:
assert(0);
}
default:
assert(0);
}
- return NULL;
+ numa_set_preferred(oldnode);
+ return shm_object;
}
struct shm_object *shm_object_table_append_shm(struct shm_object_table *table,
}
struct shm_object *shm_object_table_append_shm(struct shm_object_table *table,
This page took
0.022849 seconds
and
4
git commands to generate.