Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: add sending,pending queue and max slot to xprt stats

With static RPC slots, the xprt backlog queue stats were useful in showing
when the transport (TCP) was starved by lack of RPC slots. The new dynamic
RPC slot code, commit d9ba131d8f58c0d2ff5029e7002ab43f913b36f9, always
provides an RPC slot and so only uses the xprt backlog queue when the
tcp_max_slot_table_entries value has been hit or when an allocation error
occurs. All requests are now placed on the xprt sending or pending queue which
need to be monitored for debugging.

The max_slot stat shows the maximum number of dynamic RPC slots reached which is
useful when debugging performance issues.

Add the new fields at the end of the mountstats xprt stanza so that mountstats
outputs the previous correct values and ignores the new fields. Bump
NFS_IOSTATS_VERS.

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

authored by

Andy Adamson and committed by
Trond Myklebust
15a45206 1d96e80f

+29 -10
+1 -1
include/linux/nfs_iostat.h
··· 21 21 #ifndef _LINUX_NFS_IOSTAT 22 22 #define _LINUX_NFS_IOSTAT 23 23 24 - #define NFS_IOSTAT_VERS "1.0" 24 + #define NFS_IOSTAT_VERS "1.1" 25 25 26 26 /* 27 27 * NFS byte counters
+5 -2
include/linux/sunrpc/xprt.h
··· 219 219 connect_time, /* jiffies waiting for connect */ 220 220 sends, /* how many complete requests */ 221 221 recvs, /* how many complete requests */ 222 - bad_xids; /* lookup_rqst didn't find XID */ 222 + bad_xids, /* lookup_rqst didn't find XID */ 223 + max_slots; /* max rpc_slots used */ 223 224 224 225 unsigned long long req_u, /* average requests on the wire */ 225 - bklog_u; /* backlog queue utilization */ 226 + bklog_u, /* backlog queue utilization */ 227 + sending_u, /* send q utilization */ 228 + pending_u; /* pend q utilization */ 226 229 } stat; 227 230 228 231 struct net *xprt_net;
+6 -1
net/sunrpc/xprt.c
··· 885 885 { 886 886 struct rpc_rqst *req = task->tk_rqstp; 887 887 struct rpc_xprt *xprt = req->rq_xprt; 888 - int status; 888 + int status, numreqs; 889 889 890 890 dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen); 891 891 ··· 922 922 923 923 xprt->ops->set_retrans_timeout(task); 924 924 925 + numreqs = atomic_read(&xprt->num_reqs); 926 + if (numreqs > xprt->stat.max_slots) 927 + xprt->stat.max_slots = numreqs; 925 928 xprt->stat.sends++; 926 929 xprt->stat.req_u += xprt->stat.sends - xprt->stat.recvs; 927 930 xprt->stat.bklog_u += xprt->backlog.qlen; 931 + xprt->stat.sending_u += xprt->sending.qlen; 932 + xprt->stat.pending_u += xprt->pending.qlen; 928 933 929 934 /* Don't race with disconnect */ 930 935 if (!xprt_connected(xprt))
+17 -6
net/sunrpc/xprtsock.c
··· 2227 2227 idle_time = (long)(jiffies - xprt->last_used) / HZ; 2228 2228 2229 2229 seq_printf(seq, "\txprt:\tlocal %lu %lu %lu %ld %lu %lu %lu " 2230 - "%llu %llu\n", 2230 + "%llu %llu %lu %llu %llu\n", 2231 2231 xprt->stat.bind_count, 2232 2232 xprt->stat.connect_count, 2233 2233 xprt->stat.connect_time, ··· 2236 2236 xprt->stat.recvs, 2237 2237 xprt->stat.bad_xids, 2238 2238 xprt->stat.req_u, 2239 - xprt->stat.bklog_u); 2239 + xprt->stat.bklog_u, 2240 + xprt->stat.max_slots, 2241 + xprt->stat.sending_u, 2242 + xprt->stat.pending_u); 2240 2243 } 2241 2244 2242 2245 /** ··· 2252 2249 { 2253 2250 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 2254 2251 2255 - seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %Lu %Lu\n", 2252 + seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %llu %llu " 2253 + "%lu %llu %llu\n", 2256 2254 transport->srcport, 2257 2255 xprt->stat.bind_count, 2258 2256 xprt->stat.sends, 2259 2257 xprt->stat.recvs, 2260 2258 xprt->stat.bad_xids, 2261 2259 xprt->stat.req_u, 2262 - xprt->stat.bklog_u); 2260 + xprt->stat.bklog_u, 2261 + xprt->stat.max_slots, 2262 + xprt->stat.sending_u, 2263 + xprt->stat.pending_u); 2263 2264 } 2264 2265 2265 2266 /** ··· 2280 2273 if (xprt_connected(xprt)) 2281 2274 idle_time = (long)(jiffies - xprt->last_used) / HZ; 2282 2275 2283 - seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu %Lu %Lu\n", 2276 + seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu " 2277 + "%llu %llu %lu %llu %llu\n", 2284 2278 transport->srcport, 2285 2279 xprt->stat.bind_count, 2286 2280 xprt->stat.connect_count, ··· 2291 2283 xprt->stat.recvs, 2292 2284 xprt->stat.bad_xids, 2293 2285 xprt->stat.req_u, 2294 - xprt->stat.bklog_u); 2286 + xprt->stat.bklog_u, 2287 + xprt->stat.max_slots, 2288 + xprt->stat.sending_u, 2289 + xprt->stat.pending_u); 2295 2290 } 2296 2291 2297 2292 /*