From: Chuck Lever <chuck.lever@oracle.com>
Date: Mon, 19 Aug 2019 18:47:57 -0400
Subject: xprtrdma: Remove rpcrdma_buffer::rb_mrlock
Patch-mainline: v5.4-rc1
Git-commit: 4d6b8890ddb16120c5dd25edc8d215cfd8222b63
References: jsc#SLE-8449
Clean up: Now that the free list is used sparingly, get rid of the
separate spin lock protecting it.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
net/sunrpc/xprtrdma/frwr_ops.c | 4 ++--
net/sunrpc/xprtrdma/verbs.c | 21 ++++++++++-----------
net/sunrpc/xprtrdma/xprt_rdma.h | 9 ++++-----
3 files changed, 16 insertions(+), 18 deletions(-)
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -106,10 +106,10 @@ frwr_mr_recycle_worker(struct work_struc
mr->mr_dir = DMA_NONE;
}
- spin_lock(&r_xprt->rx_buf.rb_mrlock);
+ spin_lock(&r_xprt->rx_buf.rb_lock);
list_del(&mr->mr_all);
r_xprt->rx_stats.mrs_recycled++;
- spin_unlock(&r_xprt->rx_buf.rb_mrlock);
+ spin_unlock(&r_xprt->rx_buf.rb_lock);
frwr_release_mr(mr);
}
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -961,10 +961,10 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *
mr->mr_xprt = r_xprt;
- spin_lock(&buf->rb_mrlock);
+ spin_lock(&buf->rb_lock);
list_add(&mr->mr_list, &buf->rb_mrs);
list_add(&mr->mr_all, &buf->rb_all_mrs);
- spin_unlock(&buf->rb_mrlock);
+ spin_unlock(&buf->rb_lock);
}
r_xprt->rx_stats.mrs_allocated += count;
@@ -1083,7 +1083,6 @@ int rpcrdma_buffer_create(struct rpcrdma
buf->rb_max_requests = r_xprt->rx_ep.rep_max_requests;
buf->rb_bc_srv_max_requests = 0;
- spin_lock_init(&buf->rb_mrlock);
spin_lock_init(&buf->rb_lock);
INIT_LIST_HEAD(&buf->rb_mrs);
INIT_LIST_HEAD(&buf->rb_all_mrs);
@@ -1153,18 +1152,18 @@ rpcrdma_mrs_destroy(struct rpcrdma_buffe
unsigned int count;
count = 0;
- spin_lock(&buf->rb_mrlock);
+ spin_lock(&buf->rb_lock);
while ((mr = list_first_entry_or_null(&buf->rb_all_mrs,
struct rpcrdma_mr,
mr_all)) != NULL) {
list_del(&mr->mr_all);
- spin_unlock(&buf->rb_mrlock);
+ spin_unlock(&buf->rb_lock);
frwr_release_mr(mr);
count++;
- spin_lock(&buf->rb_mrlock);
+ spin_lock(&buf->rb_lock);
}
- spin_unlock(&buf->rb_mrlock);
+ spin_unlock(&buf->rb_lock);
r_xprt->rx_stats.mrs_allocated = 0;
}
@@ -1217,9 +1216,9 @@ rpcrdma_mr_get(struct rpcrdma_xprt *r_xp
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
struct rpcrdma_mr *mr;
- spin_lock(&buf->rb_mrlock);
+ spin_lock(&buf->rb_lock);
mr = rpcrdma_mr_pop(&buf->rb_mrs);
- spin_unlock(&buf->rb_mrlock);
+ spin_unlock(&buf->rb_lock);
return mr;
}
@@ -1248,9 +1247,9 @@ static void rpcrdma_mr_free(struct rpcrd
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
mr->mr_req = NULL;
- spin_lock(&buf->rb_mrlock);
+ spin_lock(&buf->rb_lock);
rpcrdma_mr_push(mr, &buf->rb_mrs);
- spin_unlock(&buf->rb_mrlock);
+ spin_unlock(&buf->rb_lock);
}
/**
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -360,19 +360,18 @@ rpcrdma_mr_pop(struct list_head *list)
* One of these is associated with a transport instance
*/
struct rpcrdma_buffer {
- spinlock_t rb_mrlock; /* protect rb_mrs list */
+ spinlock_t rb_lock;
+ struct list_head rb_send_bufs;
+ struct list_head rb_recv_bufs;
struct list_head rb_mrs;
- struct list_head rb_all_mrs;
unsigned long rb_sc_head;
unsigned long rb_sc_tail;
unsigned long rb_sc_last;
struct rpcrdma_sendctx **rb_sc_ctxs;
- spinlock_t rb_lock; /* protect buf lists */
- struct list_head rb_send_bufs;
- struct list_head rb_recv_bufs;
struct list_head rb_allreqs;
+ struct list_head rb_all_mrs;
u32 rb_max_requests;
u32 rb_credits; /* most recent credit grant */