aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-05-07 13:34:47 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:33 -0400
commitff8399709e41bf72b4cb145612a0f9a9f7283c83 (patch)
tree5577163d56e30020d907245f00dcef17730f037b /net/sunrpc/xprt.c
parentf56916b97fe2031761ca611f0a342efd913afb33 (diff)
SUNRPC: Replace jiffies-based metrics with ktime-based metrics
Currently RPC performance metrics that tabulate elapsed time use jiffies time values. This is problematic on systems that use slow jiffies (for instance 100HZ systems built for paravirtualized environments). It is also a problem for computing precise latency statistics for advanced network transports, such as InfiniBand, that can have round-trip latencies significanly faster than a single clock tick. For the RPC client, adopt the high resolution time stamp mechanism already used by the network layer and blktrace: ktime. We use ktime format time stamps for all internal computations, and convert to milliseconds for presentation. As a result, we need only addition operations in the performance critical paths; multiply/divide is required only for presentation. We could report RTT metrics in microseconds. In fact the mountstats format is versioned to accomodate exactly this kind of interface improvement. For now, however, we'll stay with millisecond precision for presentation to maintain backwards compatibility with the handful of currently deployed user space tools. At a later point, we'll move to an API such as BDI_STATS where a finer timestamp precision can be reported. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 698c62712294..8986b1b82862 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -43,6 +43,7 @@
43#include <linux/interrupt.h> 43#include <linux/interrupt.h>
44#include <linux/workqueue.h> 44#include <linux/workqueue.h>
45#include <linux/net.h> 45#include <linux/net.h>
46#include <linux/ktime.h>
46 47
47#include <linux/sunrpc/clnt.h> 48#include <linux/sunrpc/clnt.h>
48#include <linux/sunrpc/metrics.h> 49#include <linux/sunrpc/metrics.h>
@@ -779,10 +780,11 @@ static void xprt_update_rtt(struct rpc_task *task)
779 struct rpc_rqst *req = task->tk_rqstp; 780 struct rpc_rqst *req = task->tk_rqstp;
780 struct rpc_rtt *rtt = task->tk_client->cl_rtt; 781 struct rpc_rtt *rtt = task->tk_client->cl_rtt;
781 unsigned timer = task->tk_msg.rpc_proc->p_timer; 782 unsigned timer = task->tk_msg.rpc_proc->p_timer;
783 long m = usecs_to_jiffies(ktime_to_us(task->tk_rtt));
782 784
783 if (timer) { 785 if (timer) {
784 if (req->rq_ntrans == 1) 786 if (req->rq_ntrans == 1)
785 rpc_update_rtt(rtt, timer, task->tk_rtt); 787 rpc_update_rtt(rtt, timer, m);
786 rpc_set_timeo(rtt, timer, req->rq_ntrans - 1); 788 rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
787 } 789 }
788} 790}
@@ -803,7 +805,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied)
803 task->tk_pid, ntohl(req->rq_xid), copied); 805 task->tk_pid, ntohl(req->rq_xid), copied);
804 806
805 xprt->stat.recvs++; 807 xprt->stat.recvs++;
806 task->tk_rtt = (long)jiffies - req->rq_xtime; 808 task->tk_rtt = ktime_sub(ktime_get(), req->rq_xtime);
807 if (xprt->ops->timer != NULL) 809 if (xprt->ops->timer != NULL)
808 xprt_update_rtt(task); 810 xprt_update_rtt(task);
809 811
@@ -904,7 +906,7 @@ void xprt_transmit(struct rpc_task *task)
904 return; 906 return;
905 907
906 req->rq_connect_cookie = xprt->connect_cookie; 908 req->rq_connect_cookie = xprt->connect_cookie;
907 req->rq_xtime = jiffies; 909 req->rq_xtime = ktime_get();
908 status = xprt->ops->send_request(task); 910 status = xprt->ops->send_request(task);
909 if (status != 0) { 911 if (status != 0) {
910 task->tk_status = status; 912 task->tk_status = status;