From 5ebb028fe8e0cd5f58b5d0368f32e5179dc5db76 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 21 Nov 2016 16:08:22 -0500 Subject: [PATCH] Performance: add missing unlikely in reserve Add missing branch prediction hints within lttng_event_reserve(). Signed-off-by: Mathieu Desnoyers --- lttng-ring-buffer-client.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lttng-ring-buffer-client.h b/lttng-ring-buffer-client.h index c4b7304f..63f2b4ca 100644 --- a/lttng-ring-buffer-client.h +++ b/lttng-ring-buffer-client.h @@ -606,7 +606,7 @@ int lttng_event_reserve(struct lib_ring_buffer_ctx *ctx, int ret, cpu; cpu = lib_ring_buffer_get_cpu(&client_config); - if (cpu < 0) + if (unlikely(cpu < 0)) return -EPERM; ctx->cpu = cpu; @@ -624,7 +624,7 @@ int lttng_event_reserve(struct lib_ring_buffer_ctx *ctx, } ret = lib_ring_buffer_reserve(&client_config, ctx); - if (ret) + if (unlikely(ret)) goto put; lib_ring_buffer_backend_get_pages(&client_config, ctx, &ctx->backend_pages); -- 2.34.1