Commit 65ba3d24 authored by Chuck Lever's avatar Chuck Lever
Browse files

SUNRPC: Use per-CPU counters to tally server RPC counts



 - Improves counting accuracy
 - Reduces cross-CPU memory traffic

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent f5f9d4a3
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -721,7 +721,7 @@ static int nlmsvc_dispatch(struct svc_rqst *rqstp)
/*
 * Define NLM program and procedures
 */
static unsigned int nlmsvc_version1_count[17];
static DEFINE_PER_CPU_ALIGNED(unsigned long, nlmsvc_version1_count[17]);
static const struct svc_version	nlmsvc_version1 = {
	.vs_vers	= 1,
	.vs_nproc	= 17,
@@ -730,26 +730,31 @@ static const struct svc_version nlmsvc_version1 = {
	.vs_dispatch	= nlmsvc_dispatch,
	.vs_xdrsize	= NLMSVC_XDRSIZE,
};
static unsigned int nlmsvc_version3_count[24];

static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nlmsvc_version3_count[ARRAY_SIZE(nlmsvc_procedures)]);
static const struct svc_version	nlmsvc_version3 = {
	.vs_vers	= 3,
	.vs_nproc	= 24,
	.vs_nproc	= ARRAY_SIZE(nlmsvc_procedures),
	.vs_proc	= nlmsvc_procedures,
	.vs_count	= nlmsvc_version3_count,
	.vs_dispatch	= nlmsvc_dispatch,
	.vs_xdrsize	= NLMSVC_XDRSIZE,
};

#ifdef CONFIG_LOCKD_V4
static unsigned int nlmsvc_version4_count[24];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nlmsvc_version4_count[ARRAY_SIZE(nlmsvc_procedures4)]);
static const struct svc_version	nlmsvc_version4 = {
	.vs_vers	= 4,
	.vs_nproc	= 24,
	.vs_nproc	= ARRAY_SIZE(nlmsvc_procedures4),
	.vs_proc	= nlmsvc_procedures4,
	.vs_count	= nlmsvc_version4_count,
	.vs_dispatch	= nlmsvc_dispatch,
	.vs_xdrsize	= NLMSVC_XDRSIZE,
};
#endif

static const struct svc_version *nlmsvc_version[] = {
	[1] = &nlmsvc_version1,
	[3] = &nlmsvc_version3,
+4 −2
Original line number Diff line number Diff line
@@ -1069,7 +1069,8 @@ static const struct svc_procedure nfs4_callback_procedures1[] = {
	}
};

static unsigned int nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfs4_callback_count1[ARRAY_SIZE(nfs4_callback_procedures1)]);
const struct svc_version nfs4_callback_version1 = {
	.vs_vers = 1,
	.vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
@@ -1081,7 +1082,8 @@ const struct svc_version nfs4_callback_version1 = {
	.vs_need_cong_ctrl = true,
};

static unsigned int nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfs4_callback_count4[ARRAY_SIZE(nfs4_callback_procedures1)]);
const struct svc_version nfs4_callback_version4 = {
	.vs_vers = 4,
	.vs_nproc = ARRAY_SIZE(nfs4_callback_procedures1),
+3 −2
Original line number Diff line number Diff line
@@ -377,10 +377,11 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
	},
};

static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)]);
const struct svc_version nfsd_acl_version2 = {
	.vs_vers	= 2,
	.vs_nproc	= 5,
	.vs_nproc	= ARRAY_SIZE(nfsd_acl_procedures2),
	.vs_proc	= nfsd_acl_procedures2,
	.vs_count	= nfsd_acl_count2,
	.vs_dispatch	= nfsd_dispatch,
+3 −2
Original line number Diff line number Diff line
@@ -266,10 +266,11 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
	},
};

static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)]);
const struct svc_version nfsd_acl_version3 = {
	.vs_vers	= 3,
	.vs_nproc	= 3,
	.vs_nproc	= ARRAY_SIZE(nfsd_acl_procedures3),
	.vs_proc	= nfsd_acl_procedures3,
	.vs_count	= nfsd_acl_count3,
	.vs_dispatch	= nfsd_dispatch,
+3 −2
Original line number Diff line number Diff line
@@ -1064,10 +1064,11 @@ static const struct svc_procedure nfsd_procedures3[22] = {
	},
};

static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)];
static DEFINE_PER_CPU_ALIGNED(unsigned long,
			      nfsd_count3[ARRAY_SIZE(nfsd_procedures3)]);
const struct svc_version nfsd_version3 = {
	.vs_vers	= 3,
	.vs_nproc	= 22,
	.vs_nproc	= ARRAY_SIZE(nfsd_procedures3),
	.vs_proc	= nfsd_procedures3,
	.vs_dispatch	= nfsd_dispatch,
	.vs_count	= nfsd_count3,
Loading