Skip to content

Commit 15a4520

Browse files
androsadamsonTrond Myklebust
authored andcommitted
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 d9ba131, 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>
1 parent 1d96e80 commit 15a4520

4 files changed

Lines changed: 29 additions & 10 deletions

File tree

‎include/linux/nfs_iostat.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#ifndef _LINUX_NFS_IOSTAT
2222
#define _LINUX_NFS_IOSTAT
2323

24-
#define NFS_IOSTAT_VERS "1.0"
24+
#define NFS_IOSTAT_VERS "1.1"
2525

2626
/*
2727
* NFS byte counters

‎include/linux/sunrpc/xprt.h‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,13 @@ struct rpc_xprt {
219219
connect_time, /* jiffies waiting for connect */
220220
sends, /* how many complete requests */
221221
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 */
223224

224225
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 */
226229
} stat;
227230

228231
struct net *xprt_net;

‎net/sunrpc/xprt.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ void xprt_transmit(struct rpc_task *task)
885885
{
886886
struct rpc_rqst *req = task->tk_rqstp;
887887
struct rpc_xprt *xprt = req->rq_xprt;
888-
int status;
888+
int status, numreqs;
889889

890890
dprintk("RPC: %5u xprt_transmit(%u)\n", task->tk_pid, req->rq_slen);
891891

@@ -922,9 +922,14 @@ void xprt_transmit(struct rpc_task *task)
922922

923923
xprt->ops->set_retrans_timeout(task);
924924

925+
numreqs = atomic_read(&xprt->num_reqs);
926+
if (numreqs > xprt->stat.max_slots)
927+
xprt->stat.max_slots = numreqs;
925928
xprt->stat.sends++;
926929
xprt->stat.req_u += xprt->stat.sends - xprt->stat.recvs;
927930
xprt->stat.bklog_u += xprt->backlog.qlen;
931+
xprt->stat.sending_u += xprt->sending.qlen;
932+
xprt->stat.pending_u += xprt->pending.qlen;
928933

929934
/* Don't race with disconnect */
930935
if (!xprt_connected(xprt))

‎net/sunrpc/xprtsock.c‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ static void xs_local_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
22272227
idle_time = (long)(jiffies - xprt->last_used) / HZ;
22282228

22292229
seq_printf(seq, "\txprt:\tlocal %lu %lu %lu %ld %lu %lu %lu "
2230-
"%llu %llu\n",
2230+
"%llu %llu %lu %llu %llu\n",
22312231
xprt->stat.bind_count,
22322232
xprt->stat.connect_count,
22332233
xprt->stat.connect_time,
@@ -2236,7 +2236,10 @@ static void xs_local_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
22362236
xprt->stat.recvs,
22372237
xprt->stat.bad_xids,
22382238
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);
22402243
}
22412244

22422245
/**
@@ -2249,14 +2252,18 @@ static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
22492252
{
22502253
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
22512254

2252-
seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %Lu %Lu\n",
2255+
seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %llu %llu "
2256+
"%lu %llu %llu\n",
22532257
transport->srcport,
22542258
xprt->stat.bind_count,
22552259
xprt->stat.sends,
22562260
xprt->stat.recvs,
22572261
xprt->stat.bad_xids,
22582262
xprt->stat.req_u,
2259-
xprt->stat.bklog_u);
2263+
xprt->stat.bklog_u,
2264+
xprt->stat.max_slots,
2265+
xprt->stat.sending_u,
2266+
xprt->stat.pending_u);
22602267
}
22612268

22622269
/**
@@ -2273,7 +2280,8 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
22732280
if (xprt_connected(xprt))
22742281
idle_time = (long)(jiffies - xprt->last_used) / HZ;
22752282

2276-
seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu %Lu %Lu\n",
2283+
seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu "
2284+
"%llu %llu %lu %llu %llu\n",
22772285
transport->srcport,
22782286
xprt->stat.bind_count,
22792287
xprt->stat.connect_count,
@@ -2283,7 +2291,10 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
22832291
xprt->stat.recvs,
22842292
xprt->stat.bad_xids,
22852293
xprt->stat.req_u,
2286-
xprt->stat.bklog_u);
2294+
xprt->stat.bklog_u,
2295+
xprt->stat.max_slots,
2296+
xprt->stat.sending_u,
2297+
xprt->stat.pending_u);
22872298
}
22882299

22892300
/*

0 commit comments

Comments
 (0)