Fix: perform the initialization memory barrier out of loop body
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 9c2458eb1a15a1bee49d1a1babe3d0390418390e..3d2cad9361464534128a44f5917d01f1e58899fe 100644 (file)
@@ -4574,8 +4574,17 @@ static void *thread_manage_clients(void *data)
                if (ret > 0 || (ret < 0 && errno != EINTR)) {
                        goto exit;
                }
-               cmm_smp_rmb();
        }
+       /*
+        * This barrier is paired with the one in sessiond_notify_ready() to
+        * ensure that loads accessing data initialized by the other threads,
+        * on which this thread was waiting, are not performed before this point.
+        *
+        * Note that this could be a 'read' memory barrier, but a full barrier
+        * is used in case the code changes. The performance implications of
+        * this choice are minimal since this is a slow path.
+        */
+       cmm_smp_mb();
 
        /* This testpoint is after we signal readiness to the parent. */
        if (testpoint(sessiond_thread_manage_clients)) {
This page took 0.026797 seconds and 5 git commands to generate.