diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-01-10 16:31:54 +0100 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-02-20 15:20:32 +0100 |
commit | 65ba3d2425bf51165b6e88509c632bd15d12883d (patch) | |
tree | 63f796a78d0ff8b0ce5d635f10d9e543af89bab3 /net | |
parent | nfsd: move reply cache initialization into nfsd startup (diff) | |
download | linux-65ba3d2425bf51165b6e88509c632bd15d12883d.tar.xz linux-65ba3d2425bf51165b6e88509c632bd15d12883d.zip |
SUNRPC: Use per-CPU counters to tally server RPC counts
- Improves counting accuracy
- Reduces cross-CPU memory traffic
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/stats.c | 11 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 52908f9e6eab..65fc1297c6df 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -83,7 +83,8 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) { const struct svc_program *prog = statp->program; const struct svc_version *vers; - unsigned int i, j; + unsigned int i, j, k; + unsigned long count; seq_printf(seq, "net %u %u %u %u\n", @@ -104,8 +105,12 @@ void svc_seq_show(struct seq_file *seq, const struct svc_stat *statp) if (!vers) continue; seq_printf(seq, "proc%d %u", i, vers->vs_nproc); - for (j = 0; j < vers->vs_nproc; j++) - seq_printf(seq, " %u", vers->vs_count[j]); + for (j = 0; j < vers->vs_nproc; j++) { + count = 0; + for_each_possible_cpu(k) + count += per_cpu(vers->vs_count[j], k); + seq_printf(seq, " %lu", count); + } seq_putc(seq, '\n'); } } diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 7b208e063334..5dc298c30ea8 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1208,7 +1208,7 @@ svc_generic_init_request(struct svc_rqst *rqstp, memset(rqstp->rq_resp, 0, procp->pc_ressize); /* Bump per-procedure stats counter */ - versp->vs_count[rqstp->rq_proc]++; + this_cpu_inc(versp->vs_count[rqstp->rq_proc]); ret->dispatch = versp->vs_dispatch; return rpc_success; |