Skip to content

Commit

Permalink
svcrdma: Restore read and write stats
Browse files Browse the repository at this point in the history
Now that we have an efficient mechanism to update these two stats,
let's start maintaining them again.

Signed-off-by: Chuck Lever <[email protected]>
  • Loading branch information
chucklever committed Jan 25, 2021
1 parent 22df5a2 commit 1e7e557
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/linux/sunrpc/svc_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ extern unsigned int svcrdma_max_requests;
extern unsigned int svcrdma_max_bc_requests;
extern unsigned int svcrdma_max_req_size;

extern struct percpu_counter svcrdma_stat_read;
extern struct percpu_counter svcrdma_stat_recv;
extern atomic_t rdma_stat_read;
extern atomic_t rdma_stat_write;
extern struct percpu_counter svcrdma_stat_sq_starve;
extern struct percpu_counter svcrdma_stat_write;
extern atomic_t rdma_stat_rq_starve;
extern atomic_t rdma_stat_rq_poll;
extern atomic_t rdma_stat_rq_prod;
Expand Down
26 changes: 18 additions & 8 deletions net/sunrpc/xprtrdma/svc_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ unsigned int svcrdma_max_req_size = RPCRDMA_DEF_INLINE_THRESH;
static unsigned int min_max_inline = RPCRDMA_DEF_INLINE_THRESH;
static unsigned int max_max_inline = RPCRDMA_MAX_INLINE_THRESH;

struct percpu_counter svcrdma_stat_read;
struct percpu_counter svcrdma_stat_recv;
atomic_t rdma_stat_read;
atomic_t rdma_stat_write;
struct percpu_counter svcrdma_stat_sq_starve;
struct percpu_counter svcrdma_stat_write;
atomic_t rdma_stat_rq_starve;
atomic_t rdma_stat_rq_poll;
atomic_t rdma_stat_rq_prod;
Expand Down Expand Up @@ -178,10 +178,10 @@ static struct ctl_table svcrdma_parm_table[] = {

{
.procname = "rdma_stat_read",
.data = &rdma_stat_read,
.maxlen = sizeof(atomic_t),
.data = &svcrdma_stat_read,
.maxlen = SVCRDMA_COUNTER_BUFSIZ,
.mode = 0644,
.proc_handler = read_reset_stat,
.proc_handler = svcrdma_counter_handler,
},
{
.procname = "rdma_stat_recv",
Expand All @@ -192,10 +192,10 @@ static struct ctl_table svcrdma_parm_table[] = {
},
{
.procname = "rdma_stat_write",
.data = &rdma_stat_write,
.maxlen = sizeof(atomic_t),
.data = &svcrdma_stat_write,
.maxlen = SVCRDMA_COUNTER_BUFSIZ,
.mode = 0644,
.proc_handler = read_reset_stat,
.proc_handler = svcrdma_counter_handler,
},
{
.procname = "rdma_stat_sq_starve",
Expand Down Expand Up @@ -267,8 +267,10 @@ static void svc_rdma_proc_cleanup(void)
unregister_sysctl_table(svcrdma_table_header);
svcrdma_table_header = NULL;

percpu_counter_destroy(&svcrdma_stat_write);
percpu_counter_destroy(&svcrdma_stat_sq_starve);
percpu_counter_destroy(&svcrdma_stat_recv);
percpu_counter_destroy(&svcrdma_stat_read);
}

static int svc_rdma_proc_init(void)
Expand All @@ -278,18 +280,26 @@ static int svc_rdma_proc_init(void)
if (svcrdma_table_header)
return 0;

rc = percpu_counter_init(&svcrdma_stat_read, 0, GFP_KERNEL);
if (rc)
goto out_err;
rc = percpu_counter_init(&svcrdma_stat_recv, 0, GFP_KERNEL);
if (rc)
goto out_err;
rc = percpu_counter_init(&svcrdma_stat_sq_starve, 0, GFP_KERNEL);
if (rc)
goto out_err;
rc = percpu_counter_init(&svcrdma_stat_write, 0, GFP_KERNEL);
if (rc)
goto out_err;

svcrdma_table_header = register_sysctl_table(svcrdma_root_table);
return 0;

out_err:
percpu_counter_destroy(&svcrdma_stat_sq_starve);
percpu_counter_destroy(&svcrdma_stat_recv);
percpu_counter_destroy(&svcrdma_stat_read);
return rc;
}

Expand Down
2 changes: 2 additions & 0 deletions net/sunrpc/xprtrdma/svc_rdma_rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info,
DMA_TO_DEVICE);
if (ret < 0)
return -EIO;
percpu_counter_inc(&svcrdma_stat_write);

list_add(&ctxt->rw_list, &cc->cc_rwctxts);
cc->cc_sqecount += ret;
Expand Down Expand Up @@ -719,6 +720,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
segment->rs_handle, DMA_FROM_DEVICE);
if (ret < 0)
return -EIO;
percpu_counter_inc(&svcrdma_stat_read);

list_add(&ctxt->rw_list, &cc->cc_rwctxts);
cc->cc_sqecount += ret;
Expand Down

0 comments on commit 1e7e557

Please sign in to comment.