[PATCH 4/5] libxfs: buffer cache hashing is suboptimal

Brian Foster bfoster at redhat.com
Fri Dec 13 08:23:31 CST 2013


On 12/12/2013 03:56 PM, Dave Chinner wrote:
> On Thu, Dec 12, 2013 at 01:59:26PM -0500, Brian Foster wrote:
>> On 12/12/2013 02:22 AM, Dave Chinner wrote:
>>> From: Dave Chinner <dchinner at redhat.com>
>>>
>>> The hashkey calculation is very simplistic,and throws away an amount
>>> of entropy that should be folded into the hash. The result is
>>> sub-optimal distribution across the hash tables. For example, with a
>>> default 512 entry table, phase 2 results in this:
>>>
>> ...
>>> Modify the hash to be something more workable - steal the linux
>>> kernel inode hash calculation and try that:
>>>
>> ...
>>>
>>> Kinda says it all, really...
>>>
>>> Signed-off-by: Dave Chinner <dchinner at redhat.com>
>>> ---
>>
>> Results look nice and the algorithm seems to match the kernel variant,
>> but what about the 32-bit alternate prime/cache line values? Safe to
>> leave out..?
> 
> The buffer cache uses a 64 bit key, regardless of the platform.
> Therefore the 64 bit variant is always needed. The kernel inode hash
> uses a 32 bit key on 32 bit systems, which is why there are two
> variants for it.
> 

Ah.. xfs_bufkey->blkno is an xfs_daddr_t, which is an __int64_t. Thanks.

Reviewed-by: Brian Foster <bfoster at redhat.com>

> Cheers,
> 
> Dave.
> 



More information about the xfs mailing list