diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b630549a0c8ee4cdb62ca3b36182e7e82e933202..656454b45e9a1c38c6ddfcd38bb96b4995096a6a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,6 +58,10 @@ variables: variables: EMPER_WORKER_STATS: 'true' +.emper-userspace-rcu: + variables: + EMPER_USERSPACE_RCU: 'true' + .release-build: variables: BUILDTYPE: release @@ -105,3 +109,8 @@ test-with-stats: extends: - .test - .emper-worker-stats + +test-with-userspace-rcu: + extends: + - .test + - .emper-userspace-rcu diff --git a/emper/Runtime.cpp b/emper/Runtime.cpp index 2cc9e480b524f777e94f152fdda963cef656b601..93528d5d749d6de36cd8a03d4acc0512f638b3a6 100644 --- a/emper/Runtime.cpp +++ b/emper/Runtime.cpp @@ -8,7 +8,6 @@ // Non portable. #include <sched.h> // for cpu_set_t, CPU_SET, CPU_ZERO #include <sys/sysinfo.h> // for get_nprocs -#include <urcu.h> // for rcu_register_thread #include <cstdlib> // for rand, srand, abort #include <cstring> @@ -23,9 +22,14 @@ #include "Fiber.hpp" // for Fiber #include "RuntimeStrategy.hpp" // for RuntimeStrategy #include "RuntimeStrategyStats.hpp" // for RuntimeStrategyStats +#include "emper-config.h" // IWYU pragma: keep #include "lib/DebugUtil.hpp" #include "strategies/ws/WsStrategy.hpp" // for WsStrategy, WsStrategy::INST... +#ifdef EMPER_LIBURCU +#include <urcu.h> // for rcu_register_thread +#endif + #ifndef NDEBUG #include <syscall.h> // for SYS_gettid #include <unistd.h> // for syscall @@ -79,9 +83,9 @@ Runtime::Runtime(workerid_t workerCount, RuntimeStrategy& strategy, unsigned int workerIds[i] = i; auto thread_function = [](void* voidWorkerId) -> void* { - if constexpr (emper::LIBURCU) { - rcu_register_thread(); - } +#ifdef EMPER_LIBURCU + rcu_register_thread(); +#endif return currentRuntime->workerLoop(voidWorkerId); }; diff --git a/meson.build b/meson.build index 6c2c21e593783963abaa0561fc907a93b5a9502d..4bda5563ed2a3ebe80152fedf246cae4d7850ad0 100644 --- a/meson.build +++ b/meson.build @@ -12,14 +12,19 @@ project('EMPER', 'c', 'cpp', add_project_arguments('-Wno-non-virtual-dtor', language: 'cpp') thread_dep = dependency('threads') -liburcu_dep = dependency('liburcu') -emper_dependencies = [thread_dep, liburcu_dep] +emper_dependencies = [thread_dep] run_target('iwyu', command: 'tools/check-iwyu') conf_data = configuration_data() -conf_data.set('EMPER_LIBURCU', get_option('userspace-rcu')) +option_urcu = get_option('userspace_rcu') +conf_data.set('EMPER_LIBURCU', option_urcu) +if option_urcu + liburcu_dep = dependency('liburcu') + emper_dependencies += [liburcu_dep] +endif + conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep')) conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue')) conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue')) diff --git a/meson_options.txt b/meson_options.txt index 8032e30c80192ddd7463a3d70e288570472e3bbd..5f283147e0a5fcc70d680206d3411926213076a6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,7 +1,7 @@ option( - 'userspace-rcu', + 'userspace_rcu', type: 'boolean', - value: true, + value: false, description: 'Allow EMPER fibers to use userspace RCU', ) option( diff --git a/tests/meson.build b/tests/meson.build index 4365140346e0ac17d97cd37f6ecb7a60834376f4..f2c0134f59c8c6b5513e872cc60d2ce0948b8533 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,6 +1,6 @@ cc = meson.get_compiler('c') -liburcu_memb = cc.find_library('urcu-memb') -liburcu_cds = cc.find_library('urcu-cds') +liburcu_memb = option_urcu ? cc.find_library('urcu-memb') : disabler() +liburcu_cds = option_urcu ? cc.find_library('urcu-cds') : disabler() tests = { 'SimpleFibTest.cpp':