Skip to content

Commit 7578b2f

Browse files
committed
NFSD: Remove be32_to_cpu() from DRC hash function
Commit 7142b98 ("nfsd: Clean up drc cache in preparation for global spinlock elimination"), billed as a clean-up, added be32_to_cpu() to the DRC hash function without explanation. That commit removed two comments that state that byte-swapping in the hash function is unnecessary without explaining whether there was a need for that change. On some Intel CPUs, the swab32 instruction is known to cause a CPU pipeline stall. be32_to_cpu() does not add extra randomness, since the hash multiplication is done /before/ shifting to the high-order bits of the result. As a micro-optimization, remove the unnecessary transform from the DRC hash function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 23a1a57 commit 7578b2f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/nfsd/nfscache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ nfsd_hashsize(unsigned int limit)
8787
static u32
8888
nfsd_cache_hash(__be32 xid, struct nfsd_net *nn)
8989
{
90-
return hash_32(be32_to_cpu(xid), nn->maskbits);
90+
return hash_32((__force u32)xid, nn->maskbits);
9191
}
9292

9393
static struct svc_cacherep *

0 commit comments

Comments
 (0)