• Jeff Layton's avatar
    nfsd: scale up the number of DRC hash buckets with cache size · 0733c7ba
    Jeff Layton authored
    We've now increased the size of the duplicate reply cache by quite a
    bit, but the number of hash buckets has not changed. So, we've gone from
    an average hash chain length of 16 in the old code to 4096 when the
    cache is its largest. Change the code to scale out the number of buckets
    with the max size of the cache.
    
    At the same time, we also need to fix the hash function since the
    existing one isn't really suitable when there are more than 256 buckets.
    Move instead to use the stock hash_32 function for this. Testing on a
    machine that had 2048 buckets showed that this gave a smaller
    longest:average ratio than the existing hash function:
    
    The formula here is longest hash bucket searched divided by average
    number of entries per bucket at the time that we saw that longest
    bucket:
    
        old hash: 68/(39258/2048) == 3.547404
        hash_32:  45/(33773/2048) == 2.728807
    Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    0733c7ba
nfscache.c 15.8 KB