mbox series

[RFC,0/2] Replace file_hashtbl with an rhashtable

Message ID 166429914973.4564.115423416224540586.stgit@manet.1015granger.net (mailing list archive)
Headers show
Series Replace file_hashtbl with an rhashtable | expand

Message

Chuck Lever Sept. 27, 2022, 5:22 p.m. UTC
Hi, while testing I noticed that sometimes thousands of items are
inserted into file_hashtbl, but it's a small fixed-size hash. That
makes the buckets in file_hashtbl larger than two or three items.
The comparison function (fh_match) used while walking through the
buckets is expensive and cache-unfriendly.

The following patches seem to help alleviate that overhead.

---

Chuck Lever (2):
      NFSD: Use const pointers as parameters to fh_ helpers.
      NFSD: Use rhashtable for managing nfs4_file objects


 fs/nfsd/nfs4state.c | 227 ++++++++++++++++++++++++++++++--------------
 fs/nfsd/nfsfh.h     |  10 +-
 fs/nfsd/state.h     |   5 +-
 3 files changed, 162 insertions(+), 80 deletions(-)

--
Chuck Lever

Comments

Jeff Layton Sept. 28, 2022, 10:23 a.m. UTC | #1
On Tue, 2022-09-27 at 13:22 -0400, Chuck Lever wrote:
> Hi, while testing I noticed that sometimes thousands of items are
> inserted into file_hashtbl, but it's a small fixed-size hash. That
> makes the buckets in file_hashtbl larger than two or three items.
> The comparison function (fh_match) used while walking through the
> buckets is expensive and cache-unfriendly.
> 
> The following patches seem to help alleviate that overhead.
> 
> ---
> 
> Chuck Lever (2):
>       NFSD: Use const pointers as parameters to fh_ helpers.
>       NFSD: Use rhashtable for managing nfs4_file objects
> 
> 
>  fs/nfsd/nfs4state.c | 227 ++++++++++++++++++++++++++++++--------------
>  fs/nfsd/nfsfh.h     |  10 +-
>  fs/nfsd/state.h     |   5 +-
>  3 files changed, 162 insertions(+), 80 deletions(-)
> 
> --
> Chuck Lever
> 

This set all looks reasonable to me, and I like the idea of moving to
rhashtable. You can add:

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Chuck Lever Sept. 29, 2022, 4:20 p.m. UTC | #2
> On Sep 28, 2022, at 6:23 AM, Jeff Layton <jlayton@kernel.org> wrote:
> 
> On Tue, 2022-09-27 at 13:22 -0400, Chuck Lever wrote:
>> Hi, while testing I noticed that sometimes thousands of items are
>> inserted into file_hashtbl, but it's a small fixed-size hash. That
>> makes the buckets in file_hashtbl larger than two or three items.
>> The comparison function (fh_match) used while walking through the
>> buckets is expensive and cache-unfriendly.
>> 
>> The following patches seem to help alleviate that overhead.
>> 
>> ---
>> 
>> Chuck Lever (2):
>>      NFSD: Use const pointers as parameters to fh_ helpers.
>>      NFSD: Use rhashtable for managing nfs4_file objects
>> 
>> 
>> fs/nfsd/nfs4state.c | 227 ++++++++++++++++++++++++++++++--------------
>> fs/nfsd/nfsfh.h     |  10 +-
>> fs/nfsd/state.h     |   5 +-
>> 3 files changed, 162 insertions(+), 80 deletions(-)
>> 
>> --
>> Chuck Lever
>> 
> 
> This set all looks reasonable to me, and I like the idea of moving to
> rhashtable. You can add:
> 
> Reviewed-by: Jeff Layton <jlayton@kernel.org>

Thanks for having a look. I'm not sure I want to push these as soon
as v6.1, as they are quite fresh. That might increase the likelihood
of collisions when you work on cleaning up stateID reference counting.


--
Chuck Lever