Skip to content

sunrpc: reduce pool->sp_lock contention when queueing a xprt for servicing

Jeff Layton linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 26 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sunrpc: add a rcu_head to svc_rqst and use kfree_rcu to free itinclude/linux/sunrpc/svc.h include/trace/events/sunrpc.h net/sunrpc/svc.c+10 -56 replies
2/4sunrpc: fix potential races in pool_stats collectioninclude/linux/sunrpc/svc.h net/sunrpc/svc_xprt.c+9 -90 replies
3/4sunrpc: convert to lockless lookup of queued server threadsinclude/linux/sunrpc/svc.h include/trace/events/sunrpc.h net/sunrpc/svc.c +1 more+132 -10312 replies
4/4sunrpc: add some tracepoints around enqueue and dequeue of svc_xprtinclude/trace/events/sunrpc.h net/sunrpc/svc_xprt.c+110 -72 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchChris Worley
1/4T-b
2/4T-b
3/4T-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] sunrpc: reduce pool->sp_lock contention when queueing a xprt for servicing

Hi Bruce!

Here are the patches that I had mentioned earlier that reduce the contention for the pool->sp_lock when the server is heavily loaded.

The basic problem is that whenever a svc_xprt needs to be queued up for servicing, we have to take the pool->sp_lock to try and find an idle thread to service it. On a busy server, that lock becomes highly contended and that limits the throughput.

This patchset fixes this by changing how we search for an idle thread. First, we convert svc_rqst and the sp_all_threads list to be RCU-managed. Then we change the search for an idle thread to use the sp_all_threads list, which now can be done under the rcu_read_lock. When there is an available thread, queueing an xprt to it can now be done without any spinlocking.

With this, we see a pretty substantial increase in performance on a larger-scale server that is heavily loaded. Chris has some preliminary numbers, but they need to be cleaned up a bit before we can present them. I'm hoping to have those by early next week.

Jeff Layton (4):
sunrpc: add a rcu_head to svc_rqst and use kfree_rcu to free it
sunrpc: fix potential races in pool_stats collection
sunrpc: convert to lockless lookup of queued server threads
sunrpc: add some tracepoints around enqueue and dequeue of svc_xprt

 include/linux/sunrpc/svc.h    |  12 +-
 include/trace/events/sunrpc.h |  98 +++++++++++++++-
 net/sunrpc/svc.c              |  17 +--
 net/sunrpc/svc_xprt.c         | 252 ++++++++++++++++++++++++------------------
 4 files changed, 258 insertions(+), 121 deletions(-)
Signature · 1 line
2.1.0