Skip to contentSkip to conversation

NFS/RPC metrics fix-ups for 2.6.27

PATCH In review Chuck Lever 2 participants 6 messages Jun 6, 2008 – Jun 10, 2008 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover NFS/RPC metrics fix-ups for 2.6.27

Hi Trond-

Here are two patches that address minor issues with NFS and RPC performance metrics. See the patch descriptions for details. Please consider these for 2.6.27.

Signature · 1 line
corporate:    <chuck dot lever at oracle dot com>
#2 lore raw

PATCH 1/2 NFS: Move fs/nfs/iostat.h to include/linux

In reply to a message not in the archive

The fs/nfs/iostat.h header has definitions that were designed to be exposed to user space. Move the header under include/linux so user space can use the header in applications that read /proc/self/mountstats.

---

 fs/nfs/client.c            |    2 
 fs/nfs/dir.c               |    2 
 fs/nfs/direct.c            |    2 
 fs/nfs/file.c              |    2 
 fs/nfs/inode.c             |    2 
 fs/nfs/iostat.h            |  164 -----------------------------------------
 fs/nfs/nfs3proc.c          |    2 
 fs/nfs/nfs4proc.c          |    2 
 fs/nfs/read.c              |    2 
 fs/nfs/super.c             |    2 
 fs/nfs/write.c             |    2 
 include/linux/nfs_iostat.h |  178 ++++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 188 insertions(+), 174 deletions(-)
 delete mode 100644 fs/nfs/iostat.h
 create mode 100644 include/linux/nfs_iostat.h
fs/nfs/client.c +1 -1
index f2a092c..618faa3 100644
@@ -32,6 +32,7 @@
 #include <linux/seq_file.h>
 #include <linux/mount.h>
 #include <linux/nfs_idmap.h>
+#include <linux/nfs_iostat.h>
 #include <linux/vfs.h>
 #include <linux/inet.h>
 #include <linux/in6.h>
@@ -43,7 +44,6 @@
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
-#include "iostat.h"
 #include "internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_CLIENT
fs/nfs/dir.c +1 -1
index 425b984..a5cd722 100644
@@ -28,6 +28,7 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
+#include <linux/nfs_iostat.h>
 #include <linux/pagemap.h>
 #include <linux/smp_lock.h>
 #include <linux/pagevec.h>
@@ -37,7 +38,6 @@
 
 #include "nfs4_fs.h"
 #include "delegation.h"
-#include "iostat.h"
 #include "internal.h"
 
 /* #define NFS_DEBUG_VERBOSE 1 */
fs/nfs/direct.c +1 -1
index 08f6b04..581af62 100644
@@ -47,6 +47,7 @@
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
+#include <linux/nfs_iostat.h>
 #include <linux/sunrpc/clnt.h>
 
 #include <asm/system.h>
@@ -54,7 +55,6 @@
 #include <asm/atomic.h>
 
 #include "internal.h"
-#include "iostat.h"
 
 #define NFSDBG_FACILITY		NFSDBG_VFS
 
fs/nfs/file.c +1 -1
index bba6181..b47c1f2 100644
@@ -23,6 +23,7 @@
 #include <linux/stat.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
+#include <linux/nfs_iostat.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
@@ -34,7 +35,6 @@
 
 #include "delegation.h"
 #include "internal.h"
-#include "iostat.h"
 
 #define NFSDBG_FACILITY		NFSDBG_FILE
 
fs/nfs/inode.c +1 -1
index 596c5d8..5287f37 100644
@@ -34,6 +34,7 @@
 #include <linux/seq_file.h>
 #include <linux/mount.h>
 #include <linux/nfs_idmap.h>
+#include <linux/nfs_iostat.h>
 #include <linux/vfs.h>
 #include <linux/inet.h>
 #include <linux/nfs_xdr.h>
@@ -44,7 +45,6 @@
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
-#include "iostat.h"
 #include "internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_VFS
fs/nfs/iostat.h deleted +0 -164

164 lines not on this page · raw message

fs/nfs/nfs3proc.c +1 -1
index c3523ad..d461eb3 100644
@@ -17,8 +17,8 @@
 #include <linux/nfs_page.h>
 #include <linux/lockd/bind.h>
 #include <linux/nfs_mount.h>
+#include <linux/nfs_iostat.h>
 
-#include "iostat.h"
 #include "internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PROC
fs/nfs/nfs4proc.c +1 -1
index 1293e0a..df93fa8 100644
@@ -45,6 +45,7 @@
 #include <linux/nfs4.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
+#include <linux/nfs_iostat.h>
 #include <linux/smp_lock.h>
 #include <linux/namei.h>
 #include <linux/mount.h>
@@ -52,7 +53,6 @@
 #include "nfs4_fs.h"
 #include "delegation.h"
 #include "internal.h"
-#include "iostat.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PROC
 
fs/nfs/read.c +1 -1
index 40d1798..306363f 100644
@@ -18,12 +18,12 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
+#include <linux/nfs_iostat.h>
 #include <linux/smp_lock.h>
 
 #include <asm/system.h>
 
 #include "internal.h"
-#include "iostat.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PAGECACHE
 
fs/nfs/super.c +1 -1
index 2a4a024..ef27035 100644
@@ -43,6 +43,7 @@
 #include <linux/seq_file.h>
 #include <linux/mount.h>
 #include <linux/nfs_idmap.h>
+#include <linux/nfs_iostat.h>
 #include <linux/vfs.h>
 #include <linux/inet.h>
 #include <linux/in6.h>
@@ -57,7 +58,6 @@
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
-#include "iostat.h"
 #include "internal.h"
 
 #define NFSDBG_FACILITY		NFSDBG_VFS
fs/nfs/write.c +1 -1
index c03a039..1bb0593 100644
@@ -18,13 +18,13 @@
 #include <linux/nfs_fs.h>
 #include <linux/nfs_mount.h>
 #include <linux/nfs_page.h>
+#include <linux/nfs_iostat.h>
 #include <linux/backing-dev.h>
 
 #include <asm/uaccess.h>
 
 #include "delegation.h"
 #include "internal.h"
-#include "iostat.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PAGECACHE
 
include/linux/nfs_iostat.h new file +178 -0

178 lines not on this page · raw message

#5 lore raw

PATCH 2/2 SUNRPC: Ensure all transports set rq_xtime consistently

In reply to a message not in the archive

The RPC client uses the rq_xtime field in each RPC request to determine the round-trip time of the request. Currently, the rq_xtime field is initialized by each transport just before it starts enqueing a request to be sent. However, transports do not handle initializing this value consistently; sometimes they don't initialize it at all.

To make the measurement of request round-trip time consistent for all RPC client transport capabilities, pull rq_xtime initialization into the RPC client's generic transport logic. Now all transports will get a standardized RTT measure automatically, from:

xprt_transmit()

to

xprt_complete_rqst()

This makes round-trip time calculation more accurate for the TCP transport. The socket ->sendmsg() method can return "-EAGAIN" if the socket's output buffer is full, so the TCP transport's ->send_request() method may call the ->sendmsg() method repeatedly until it gets all of the request's bytes queued in the socket's buffer.

Currently, the TCP transport sets the rq_xtime field every time through that loop so the final value is the timestamp just before the *last* call to the underlying socket's ->sendmsg() method. After this patch, the rq_xtime field contains a timestamp that reflects the time just before the *first* call to ->sendmsg().

This is consequential under heavy workloads because large requests often take multiple ->sendmsg() calls to get all the bytes of a request queued. The TCP transport causes the request to sleep until the remote end of the socket has received enough bytes to clear space in the socket's local output buffer. This delay can be quite significant.

The method introduced by this patch is a more accurate measure of RTT for stream transports, since the server can cause enough back pressure to delay (ie increase the latency of) requests from the client.

Additionally, this patch corrects the behavior of the RDMA transport, which entirely neglected to initialize the rq_xtime field. RPC performance metrics for RDMA transports now display correct RPC request round trip times.

---

 net/sunrpc/xprt.c     |    1 +
 net/sunrpc/xprtsock.c |    2 --
 2 files changed, 1 insertions(+), 2 deletions(-)
net/sunrpc/xprt.c +1 -0
index 67996bd..99a52aa 100644
@@ -872,6 +872,7 @@ void xprt_transmit(struct rpc_task *task)
 		return;
 
 	req->rq_connect_cookie = xprt->connect_cookie;
+	req->rq_xtime = jiffies;
 	status = xprt->ops->send_request(task);
 	if (status == 0) {
 		dprintk("RPC: %5u xmit complete\n", task->tk_pid);
net/sunrpc/xprtsock.c +0 -2
index ddbe981..4486c59 100644
@@ -579,7 +579,6 @@ static int xs_udp_send_request(struct rpc_task *task)
 				req->rq_svec->iov_base,
 				req->rq_svec->iov_len);
 
-	req->rq_xtime = jiffies;
 	status = xs_sendpages(transport->sock,
 			      xs_addr(xprt),
 			      xprt->addrlen, xdr,
@@ -671,7 +670,6 @@ static int xs_tcp_send_request(struct rpc_task *task)
 	 * to cope with writespace callbacks arriving _after_ we have
 	 * called sendmsg(). */
 	while (1) {
-		req->rq_xtime = jiffies;
 		status = xs_sendpages(transport->sock,
 					NULL, 0, xdr, req->rq_bytes_sent);
 
#4 lore raw

Re: [PATCH 1/2] NFS: Move fs/nfs/iostat.h to include/linux

In reply to a message not in the archive
Quoted 5 lines · Chuck Lever

The fs/nfs/iostat.h header has definitions that were designed to be exposed
to user space. Move the header under include/linux so user space can use
the header in applications that read /proc/self/mountstats.

The correct way to do this is to move _only_ those parts which are designed to be exposed to user space into include/linux, and leave the #ifdef __KERNEL__ protected stuff where it is.

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#7 lore raw

Re: [PATCH 2/2] SUNRPC: Ensure all transports set rq_xtime consistently

In reply to a message not in the archive
Quoted 100 lines · Chuck Lever

The RPC client uses the rq_xtime field in each RPC request to determine the
round-trip time of the request. Currently, the rq_xtime field is initialized by each transport just before it starts enqueing a request to
be sent. However, transports do not handle initializing this value consistently; sometimes they don't initialize it at all.

To make the measurement of request round-trip time consistent for all RPC client transport capabilities, pull rq_xtime initialization into the
RPC client's generic transport logic. Now all transports will get a standardized RTT measure automatically, from:

xprt_transmit()

to

xprt_complete_rqst()

This makes round-trip time calculation more accurate for the TCP transport.
The socket ->sendmsg() method can return "-EAGAIN" if the socket's output
buffer is full, so the TCP transport's ->send_request() method may call
the ->sendmsg() method repeatedly until it gets all of the request's bytes
queued in the socket's buffer.

Currently, the TCP transport sets the rq_xtime field every time through
that loop so the final value is the timestamp just before the *last* call
to the underlying socket's ->sendmsg() method. After this patch, the rq_xtime field contains a timestamp that reflects the time just before the
*first* call to ->sendmsg().

This is consequential under heavy workloads because large requests often
take multiple ->sendmsg() calls to get all the bytes of a request queued.
The TCP transport causes the request to sleep until the remote end of the
socket has received enough bytes to clear space in the socket's local output buffer. This delay can be quite significant.

The method introduced by this patch is a more accurate measure of RTT for stream transports, since the server can cause enough back pressure to delay (ie increase the latency of) requests from the client.

Additionally, this patch corrects the behavior of the RDMA transport, which
entirely neglected to initialize the rq_xtime field. RPC performance metrics for RDMA transports now display correct RPC request round trip times.

---

 net/sunrpc/xprt.c     |    1 +
 net/sunrpc/xprtsock.c |    2 --
 2 files changed, 1 insertions(+), 2 deletions(-)
net/sunrpc/xprt.c +1 -0
index 67996bd..99a52aa 100644
@@ -872,6 +872,7 @@ void xprt_transmit(struct rpc_task *task)
                return;
 
        req->rq_connect_cookie = xprt->connect_cookie;
+       req->rq_xtime = jiffies;
        status = xprt->ops->send_request(task);
        if (status == 0) {
                dprintk("RPC: %5u xmit complete\n", task->tk_pid);
net/sunrpc/xprtsock.c +0 -1
index ddbe981..4486c59 100644
@@ -579,7 +579,6 @@ static int xs_udp_send_request(struct rpc_task
 *task)
                                req->rq_svec->iov_base,
                                req->rq_svec->iov_len);
 
-       req->rq_xtime = jiffies;
        status = xs_sendpages(transport->sock,
                              xs_addr(xprt),
                              xprt->addrlen, xdr,
net/sunrpc/xprtsock.c +0 -1
@@ -671,7 +670,6 @@ static int xs_tcp_send_request(struct rpc_task
 *task)
         * to cope with writespace callbacks arriving _after_ we have
         * called sendmsg(). */
        while (1) {
-               req->rq_xtime = jiffies;
                status = xs_sendpages(transport->sock,
                                        NULL, 0, xdr,
Quoted 2 lines

req->rq_bytes_sent);

Please resend as a _text_ patch. base64-encoded HTML isn't an acceptable format for patches...

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#8 lore raw

Re: [PATCH 2/2] SUNRPC: Ensure all transports set rq_xtime consistently

Quoted 15 lines · Trond Myklebust
Quoted 14 lines · Chuck Lever

The RPC client uses the rq_xtime field in each RPC request to determine the
round-trip time of the request. Currently, the rq_xtime field is initialized by each transport just before it starts enqueing a request to
be sent. However, transports do not handle initializing this value consistently; sometimes they don't initialize it at all.

To make the measurement of request round-trip time consistent for all RPC client transport capabilities, pull rq_xtime initialization into the
RPC client's generic transport logic. Now all transports will get a standardized RTT measure automatically, from:

Quoted 8 lines
Quoted 5 lines

xprt_transmit()

to

xprt_complete_rqst()

Please resend as a _text_ patch. base64-encoded HTML isn't an acceptable format for patches...

Sorry, I didn't do that on purpose. I posted this via 'stg mail', but it looks like the gmail.com MTA converts these. I will try a different outgoing mail service.

Signature · 1 line
Chuck Lever