aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-rw-r--r--include/linux/sunrpc/metrics.h7
-rw-r--r--include/linux/sunrpc/sched.h5
-rw-r--r--include/linux/sunrpc/xprt.h3
3 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 77f78e56c481..b6edbc0ea83d 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -26,6 +26,7 @@
26#define _LINUX_SUNRPC_METRICS_H 26#define _LINUX_SUNRPC_METRICS_H
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h>
29 30
30#define RPC_IOSTATS_VERS "1.0" 31#define RPC_IOSTATS_VERS "1.0"
31 32
@@ -58,9 +59,9 @@ struct rpc_iostats {
58 * and the total time the request spent from init to release 59 * and the total time the request spent from init to release
59 * are measured. 60 * are measured.
60 */ 61 */
61 unsigned long long om_queue, /* jiffies queued for xmit */ 62 ktime_t om_queue, /* queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */ 63 om_rtt, /* RPC RTT */
63 om_execute; /* jiffies for RPC execution */ 64 om_execute; /* RPC execution */
64} ____cacheline_aligned; 65} ____cacheline_aligned;
65 66
66struct rpc_task; 67struct rpc_task;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 7bc7fd5291ce..76720d262ef2 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -10,6 +10,7 @@
10#define _LINUX_SUNRPC_SCHED_H_ 10#define _LINUX_SUNRPC_SCHED_H_
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/ktime.h>
13#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/wait.h> 16#include <linux/wait.h>
@@ -80,8 +81,8 @@ struct rpc_task {
80 81
81 unsigned short tk_timeouts; /* maj timeouts */ 82 unsigned short tk_timeouts; /* maj timeouts */
82 size_t tk_bytes_sent; /* total bytes sent */ 83 size_t tk_bytes_sent; /* total bytes sent */
83 unsigned long tk_start; /* RPC task init timestamp */ 84 ktime_t tk_start, /* RPC task init timestamp */
84 long tk_rtt; /* round-trip time (jiffies) */ 85 tk_rtt; /* round-trip time */
85 86
86 pid_t tk_owner; /* Process id for batching tasks */ 87 pid_t tk_owner; /* Process id for batching tasks */
87 unsigned char tk_priority : 2;/* Task priority */ 88 unsigned char tk_priority : 2;/* Task priority */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 04fc342d9840..f8851861b744 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -13,6 +13,7 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <linux/ktime.h>
16#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
17#include <linux/sunrpc/xdr.h> 18#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/msg_prot.h> 19#include <linux/sunrpc/msg_prot.h>
@@ -94,7 +95,7 @@ struct rpc_rqst {
94 */ 95 */
95 u32 rq_bytes_sent; /* Bytes we have sent */ 96 u32 rq_bytes_sent; /* Bytes we have sent */
96 97
97 unsigned long rq_xtime; /* when transmitted */ 98 ktime_t rq_xtime; /* transmit time stamp */
98 int rq_ntrans; 99 int rq_ntrans;
99 100
100#if defined(CONFIG_NFS_V4_1) 101#if defined(CONFIG_NFS_V4_1)