All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path
@ 2017-08-14 12:29 Max Gurtovoy
  2017-08-15  9:08 ` Sagi Grimberg
  2017-08-16  8:10 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Max Gurtovoy @ 2017-08-14 12:29 UTC (permalink / raw)


This patch slightly improves performance (mainly for small block sizes).

Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/rdma.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index da04df1..8540dbb 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -856,7 +856,7 @@ static void nvme_rdma_unmap_data(struct nvme_rdma_queue *queue,
 
 	if (req->mr->need_inval) {
 		res = nvme_rdma_inv_rkey(queue, req);
-		if (res < 0) {
+		if (unlikely(res < 0)) {
 			dev_err(ctrl->ctrl.device,
 				"Queueing INV WR for rkey %#x failed (%d)\n",
 				req->mr->rkey, res);
@@ -921,7 +921,7 @@ static int nvme_rdma_map_sg_fr(struct nvme_rdma_queue *queue,
 	int nr;
 
 	nr = ib_map_mr_sg(req->mr, req->sg_table.sgl, count, NULL, PAGE_SIZE);
-	if (nr < count) {
+	if (unlikely(nr < count)) {
 		if (nr < 0)
 			return nr;
 		return -EINVAL;
@@ -1057,7 +1057,7 @@ static int nvme_rdma_post_send(struct nvme_rdma_queue *queue,
 		first = &wr;
 
 	ret = ib_post_send(queue->qp, first, &bad_wr);
-	if (ret) {
+	if (unlikely(ret)) {
 		dev_err(queue->ctrl->ctrl.device,
 			     "%s failed with error code %d\n", __func__, ret);
 	}
@@ -1083,7 +1083,7 @@ static int nvme_rdma_post_recv(struct nvme_rdma_queue *queue,
 	wr.num_sge  = 1;
 
 	ret = ib_post_recv(queue->qp, &wr, &bad_wr);
-	if (ret) {
+	if (unlikely(ret)) {
 		dev_err(queue->ctrl->ctrl.device,
 			"%s failed with error code %d\n", __func__, ret);
 	}
@@ -1443,7 +1443,7 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
 	blk_mq_start_request(rq);
 
 	err = nvme_rdma_map_data(queue, rq, c);
-	if (err < 0) {
+	if (unlikely(err < 0)) {
 		dev_err(queue->ctrl->ctrl.device,
 			     "Failed to map data (%d)\n", err);
 		nvme_cleanup_cmd(rq);
@@ -1457,7 +1457,7 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
 		flush = true;
 	err = nvme_rdma_post_send(queue, sqe, req->sge, req->num_sge,
 			req->mr->need_inval ? &req->reg_wr.wr : NULL, flush);
-	if (err) {
+	if (unlikely(err)) {
 		nvme_rdma_unmap_data(queue, rq);
 		goto err;
 	}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path
  2017-08-14 12:29 [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path Max Gurtovoy
@ 2017-08-15  9:08 ` Sagi Grimberg
  2017-08-15  9:15   ` Max Gurtovoy
  2017-08-16  8:10 ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2017-08-15  9:08 UTC (permalink / raw)


> This patch slightly improves performance (mainly for small block sizes).

This looks fine,

Looks fine,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

Since you mentioned it, can you quantify what that bought us?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path
  2017-08-15  9:08 ` Sagi Grimberg
@ 2017-08-15  9:15   ` Max Gurtovoy
  2017-08-15  9:58     ` Sagi Grimberg
  0 siblings, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2017-08-15  9:15 UTC (permalink / raw)




On 8/15/2017 12:08 PM, Sagi Grimberg wrote:
>> This patch slightly improves performance (mainly for small block sizes).
>
> This looks fine,
>
> Looks fine,
>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
>
> Since you mentioned it, can you quantify what that bought us?

1 subsystem, 1 ns (null blk backing device)


bs      (w/w.o)
---    ---------
512:    912k/900k
1k:     912k/900k
2k :    911k/901k
4k:     922k/906k
8k:     568k/569k
16k:    288k/288k

-Max

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path
  2017-08-15  9:15   ` Max Gurtovoy
@ 2017-08-15  9:58     ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-08-15  9:58 UTC (permalink / raw)



> 1 subsystem, 1 ns (null blk backing device)
> 
> 
> bs      (w/w.o)
> ---    ---------
> 512:    912k/900k
> 1k:     912k/900k
> 2k :    911k/901k
> 4k:     922k/906k

That's somewhat surprising...

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path
  2017-08-14 12:29 [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path Max Gurtovoy
  2017-08-15  9:08 ` Sagi Grimberg
@ 2017-08-16  8:10 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-08-16  8:10 UTC (permalink / raw)


Thanks,

applied to nvme-4.14.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-16  8:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14 12:29 [PATCH 1/1] nvme-rdma: Use unlikely macro in the fast path Max Gurtovoy
2017-08-15  9:08 ` Sagi Grimberg
2017-08-15  9:15   ` Max Gurtovoy
2017-08-15  9:58     ` Sagi Grimberg
2017-08-16  8:10 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.