From ce31ec390b63595fd49e39c1b01978ab474146d7 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 29 May 2019 02:41:16 -0700 Subject: [PATCH] nvme/perf: add some spdk_unlikely calls in the I/O path Signed-off-by: Jim Harris Change-Id: Ibc289905ea8d00146b50e7697c49b0670ef6102a Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456250 Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- examples/nvme/perf/perf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 46973ee11..2cf6acc28 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -887,7 +887,7 @@ submit_single_io(struct perf_task *task) rc = entry->fn_table->submit_io(task, ns_ctx, entry, offset_in_ios); - if (rc != 0) { + if (spdk_unlikely(rc != 0)) { fprintf(stderr, "starting I/O failed\n"); } else { ns_ctx->current_queue_depth++; @@ -907,13 +907,13 @@ task_complete(struct perf_task *task) ns_ctx->io_completed++; tsc_diff = spdk_get_ticks() - task->submit_tsc; ns_ctx->total_tsc += tsc_diff; - if (ns_ctx->min_tsc > tsc_diff) { + if (spdk_unlikely(ns_ctx->min_tsc > tsc_diff)) { ns_ctx->min_tsc = tsc_diff; } - if (ns_ctx->max_tsc < tsc_diff) { + if (spdk_unlikely(ns_ctx->max_tsc < tsc_diff)) { ns_ctx->max_tsc = tsc_diff; } - if (g_latency_sw_tracking_level > 0) { + if (spdk_unlikely(g_latency_sw_tracking_level > 0)) { spdk_histogram_data_tally(ns_ctx->histogram, tsc_diff); } @@ -928,7 +928,7 @@ task_complete(struct perf_task *task) * to complete. In this case, do not submit a new I/O to replace * the one just completed. */ - if (ns_ctx->is_draining) { + if (spdk_unlikely(ns_ctx->is_draining)) { spdk_dma_free(task->iov.iov_base); spdk_dma_free(task->md_iov.iov_base); free(task); @@ -942,7 +942,7 @@ io_complete(void *ctx, const struct spdk_nvme_cpl *cpl) { struct perf_task *task = ctx; - if (spdk_nvme_cpl_is_error(cpl)) { + if (spdk_unlikely(spdk_nvme_cpl_is_error(cpl))) { fprintf(stderr, "%s completed with error (sct=%d, sc=%d)\n", task->is_read ? "Read" : "Write", cpl->status.sct, cpl->status.sc);