Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Trond Myklebust
Date: Wednesday, November 19, 2008 - 3:31 pm

On Mon, 2008-11-17 at 13:35 +0100, Max Kellermann wrote:

Looking at the above, it seems that you're spending an inordinate amount
of time in generic_match too.
Could you see if the following patch helps?

Cheers
  Trond

-------------------------------------------------------------------------------
From: Trond Myklebust <Trond.Myklebust@netapp.com>
SUNRPC: Fix up generic_match()

Cut down on the number of similar copies of group_info.

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

 net/sunrpc/auth_generic.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)


diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index 744b79f..4028502 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -133,13 +133,29 @@ static int
 generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
 {
 	struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base);
+	int i;
 
 	if (gcred->acred.uid != acred->uid ||
 	    gcred->acred.gid != acred->gid ||
-	    gcred->acred.group_info != acred->group_info ||
 	    gcred->acred.machine_cred != acred->machine_cred)
-		return 0;
+		goto out_nomatch;
+
+	/* Optimisation in the case where pointers are identical... */
+	if (gcred->acred.group_info == acred->group_info)
+		goto out_match;
+
+	/* Slow path... */
+	if (gcred->acred.group_info->ngroups != acred->group_info->ngroups)
+		goto out_nomatch;
+	for (i = 0; i < gcred->acred.group_info->ngroups; i++) {
+		if (GROUP_AT(gcred->acred.group_info, i) !=
+				GROUP_AT(acred->group_info, i))
+			goto out_nomatch;
+	}
+out_match:
 	return 1;
+out_nomatch:
+	return 0;
 }
 
 void __init rpc_init_generic_auth(void)


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Wed Oct 22, 2:12 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, J. Bruce Fields, (Wed Oct 22, 10:56 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Thu Oct 23, 5:36 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Trond Myklebust, (Thu Oct 23, 7:55 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Fri Oct 24, 1:39 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Trond Myklebust, (Fri Oct 24, 11:09 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Mon Oct 27, 2:58 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Trond Myklebust, (Mon Oct 27, 8:48 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Mon Nov 17, 5:35 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Trond Myklebust, (Wed Nov 19, 3:31 pm)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Max Kellermann, (Thu Nov 20, 7:08 am)
Re: High load in 2.6.27, NFS / rpcauth_lookup_credcache()?, Trond Myklebust, (Tue Dec 16, 6:02 am)