From: Mathieu Desnoyers Date: Mon, 21 Nov 2016 21:08:22 +0000 (-0500) Subject: Performance: add missing unlikely in reserve X-Git-Tag: v2.9.0~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8f41484b08b6ca3e15852a934a28fb5138affcc3;p=lttng-modules.git Performance: add missing unlikely in reserve Add missing branch prediction hints within lttng_event_reserve(). Signed-off-by: Mathieu Desnoyers --- 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);