X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=9c2458eb1a15a1bee49d1a1babe3d0390418390e;hp=f9b41d2707bd26aff4f95a72aa1885d2f2f09280;hb=524423d6b372147fd0a012700873d455fa4a0737;hpb=bc4b3ff16b26d5430fe701fd0680a157c65e21f8;ds=sidebyside diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index f9b41d270..9c2458eb1 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -366,10 +366,21 @@ LTTNG_HIDDEN void sessiond_notify_ready(void) { /* - * The _return variant is used since the implied memory barriers are - * required. + * This memory barrier is paired with the one performed by + * the client thread after it has seen that 'lttng_sessiond_ready' is 0. + * + * The purpose of these memory barriers is to ensure that all + * initialization operations of the various threads that call this + * function to signal that they are ready are commited/published + * before the client thread can see the 'lttng_sessiond_ready' counter + * reach 0. + * + * Note that this could be a 'write' memory barrier, but a full barrier + * is used in case the code using this utility changes. The performance + * implications of this choice are minimal since this is a slow path. */ - (void) uatomic_sub_return(<tng_sessiond_ready, 1); + cmm_smp_mb(); + uatomic_sub(<tng_sessiond_ready, 1); } static