diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-07-15 15:12:08 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-07-16 07:11:58 -0400 |
commit | 3cf7292280d5e484747a5f0ee4b62327b037344c (patch) | |
tree | 31942b53680b0c64c364322c154753857a93eb93 /net/sunrpc | |
parent | 50c8000744463aa8534de0d739b50ed4f06f8275 (diff) |
SUNRPC: Replace division by multiplication in calculation of queue length
When checking whether or not a particular xprt queue length is shorter
than the average queue length for all xprts, prefer to use multiplication
rather than division for performance reasons.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprtmultipath.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 9d66ce53355d..5df4e7adedf0 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c | |||
@@ -322,7 +322,6 @@ struct rpc_xprt *xprt_iter_next_entry_roundrobin(struct rpc_xprt_iter *xpi) | |||
322 | struct rpc_xprt *xprt; | 322 | struct rpc_xprt *xprt; |
323 | unsigned long xprt_queuelen; | 323 | unsigned long xprt_queuelen; |
324 | unsigned long xps_queuelen; | 324 | unsigned long xps_queuelen; |
325 | unsigned long xps_avglen; | ||
326 | 325 | ||
327 | do { | 326 | do { |
328 | xprt = xprt_iter_next_entry_multiple(xpi, | 327 | xprt = xprt_iter_next_entry_multiple(xpi, |
@@ -333,8 +332,8 @@ struct rpc_xprt *xprt_iter_next_entry_roundrobin(struct rpc_xprt_iter *xpi) | |||
333 | if (xprt_queuelen <= 2) | 332 | if (xprt_queuelen <= 2) |
334 | break; | 333 | break; |
335 | xps_queuelen = atomic_long_read(&xps->xps_queuelen); | 334 | xps_queuelen = atomic_long_read(&xps->xps_queuelen); |
336 | xps_avglen = DIV_ROUND_UP(xps_queuelen, xps->xps_nactive); | 335 | /* Exit loop if xprt_queuelen <= average queue length */ |
337 | } while (xprt_queuelen > xps_avglen); | 336 | } while (xprt_queuelen * READ_ONCE(xps->xps_nactive) > xps_queuelen); |
338 | return xprt; | 337 | return xprt; |
339 | } | 338 | } |
340 | 339 | ||