Fix: don't use membarrier SHARED syscall command in liburcu-bp
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Sep 2017 20:35:59 +0000 (16:35 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Sep 2017 20:45:04 +0000 (16:45 -0400)
One main user of liburcu-bp (lttng-ust) invokes synchronize_rcu()
repeatedly, without batching (does not use call_rcu).

Those delays introduced by sys_membarrier SHARED command significantly
impacts application startup time. Therefore, revert to not using the
membarrier SHARED command.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-bp.c

index d0bfb0dc713dd563bd4b8d67b41cbac03a5227e4..9c7da3d8d235355246de95dfb5de87c8dcc1fec8 100644 (file)
--- a/urcu-bp.c
+++ b/urcu-bp.c
@@ -581,6 +581,17 @@ void urcu_bp_thread_exit_notifier(void *rcu_key)
        rcu_bp_unregister(rcu_key);
 }
 
+static
+void rcu_sys_membarrier_status(int available)
+{
+       /*
+        * membarrier has blocking behavior, which changes the
+        * application behavior too much compared to using barriers when
+        * synchronize_rcu is used repeatedly (without using call_rcu).
+        * Don't use membarrier for now.
+        */
+}
+
 static
 void rcu_bp_init(void)
 {
@@ -593,9 +604,8 @@ void rcu_bp_init(void)
                if (ret)
                        abort();
                ret = membarrier(MEMBARRIER_CMD_QUERY, 0);
-               if (ret >= 0 && (ret & MEMBARRIER_CMD_SHARED)) {
-                       urcu_bp_has_sys_membarrier = 1;
-               }
+               rcu_sys_membarrier_status(ret >= 0
+                               && (ret & MEMBARRIER_CMD_SHARED));
                initialized = 1;
        }
        mutex_unlock(&init_lock);
This page took 0.026416 seconds and 4 git commands to generate.