From: Frank Sorenson <sorenson@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 0/5] Add auth-specific auth_cred hash functions
Date: Thu, 29 Sep 2016 10:44:36 -0500 [thread overview]
Message-ID: <1475163881-12438-1-git-send-email-sorenson@redhat.com> (raw)
Currently, a single hash algorithm is used to hash the auth_cred
for lookup in the credcache for all rpc_auth flavors. Only the
uid is included in the value to be hashed.
For AUTH_SYS, rpc_creds created with the same uid but different
gids will all go on the same hash chain. In certain usage patterns,
such as the following, this can lead to extremely long hash chains
and slow performance for certain uids.
for (i = 0 ; i < 100000 ; i++) {
setregid(-1, i);
stat(path, &st);
}
With AUTH_SYS, in order to distribute the rpc_creds more evenly
throughout the cache, we want to include the gid in the hash.
However, since the gid is not relevant or appropriate for all
auth flavors, we need to provide hash functions specific to each
auth flavor. Do this by adding a 'hash_cred' function to the
rpc_authops stuct, and having rpcauth_lookup_credcache call a
hash function created for each flavor.
As a performance comparison for unix_auth, with a credcache
containing 100,000 entries, hashing both the uid and gid reduces
the time to complete an 'ls' of a single directory containing 1000
files from over 8 1/2 minutes to 4 1/2 seconds.
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Frank Sorenson (5):
sunrpc: add hash_cred() function to rpc_authops struct
sunrpc: add generic_auth hash_cred() function
sunrpc: add auth_unix hash_cred() function
sunrpc: add RPCSEC_GSS hash_cred() function
sunrpc: replace generic auth_cred hash with auth-specific function
include/linux/sunrpc/auth.h | 1 +
net/sunrpc/auth.c | 2 +-
net/sunrpc/auth_generic.c | 9 +++++++++
net/sunrpc/auth_gss/auth_gss.c | 7 +++++++
net/sunrpc/auth_unix.c | 9 +++++++++
5 files changed, 27 insertions(+), 1 deletion(-)
--
2.5.5
next reply other threads:[~2016-09-29 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 15:44 Frank Sorenson [this message]
2016-09-29 15:44 ` [PATCH 1/5] sunrpc: add hash_cred() function to rpc_authops struct Frank Sorenson
2016-09-29 15:44 ` [PATCH 2/5] sunrpc: add generic_auth hash_cred() function Frank Sorenson
2016-09-29 15:44 ` [PATCH 3/5] sunrpc: add auth_unix " Frank Sorenson
2016-09-29 15:44 ` [PATCH 4/5] sunrpc: add RPCSEC_GSS " Frank Sorenson
2016-09-29 15:44 ` [PATCH 5/5] sunrpc: replace generic auth_cred hash with auth-specific function Frank Sorenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475163881-12438-1-git-send-email-sorenson@redhat.com \
--to=sorenson@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).