Avoid buildenv conditional in thread_option struct
Managed to run into issues with an external ioengine
which got build with CONFIG_LIBNUMA not defined. Fio
itself got build with CONFIG_LIBNUMA this resulted
in different struct members offsets in the two different
ELF objects. Causing crashes due to invalidate offsets
inside the thread_data structure (e.g. td->io_ops->data).
Ideally all structs which might be used by external
ioengines should be independent of buildenv conditionals
like CONFIG_LIBNUMA or others.
Removed the CONFIG_LIBNUMA in thread_options.h and replaced
the libnuma specific "struct bitmask" members with strings
which hold the option's input value. This should also make
the marshaling/demarshaling in cconv.c easier.
(Note: the NUMA bits are not handled in cconv.c at the
moment. And not part of the thread_options_packed struct)
Signed-off-by: Daniel Gollub <daniel.gollub@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/backend.c b/backend.c
index e0f8aa7..9deef28 100644
--- a/backend.c
+++ b/backend.c
@@ -1339,6 +1339,7 @@
#ifdef CONFIG_LIBNUMA
/* numa node setup */
if (o->numa_cpumask_set || o->numa_memmask_set) {
+ struct bitmask *mask;
int ret;
if (numa_available() < 0) {
@@ -1347,7 +1348,9 @@
}
if (o->numa_cpumask_set) {
- ret = numa_run_on_node_mask(o->numa_cpunodesmask);
+ mask = numa_parse_nodestring(o->numa_cpunodes);
+ ret = numa_run_on_node_mask(mask);
+ numa_free_nodemask(mask);
if (ret == -1) {
td_verror(td, errno, \
"numa_run_on_node_mask failed\n");
@@ -1357,12 +1360,16 @@
if (o->numa_memmask_set) {
+ mask = NULL;
+ if (o->numa_memnodes)
+ mask = numa_parse_nodestring(o->numa_memnodes);
+
switch (o->numa_mem_mode) {
case MPOL_INTERLEAVE:
- numa_set_interleave_mask(o->numa_memnodesmask);
+ numa_set_interleave_mask(mask);
break;
case MPOL_BIND:
- numa_set_membind(o->numa_memnodesmask);
+ numa_set_membind(mask);
break;
case MPOL_LOCAL:
numa_set_localalloc();
@@ -1375,6 +1382,9 @@
break;
}
+ if (mask)
+ numa_free_nodemask(mask);
+
}
}
#endif