]> git.baikalelectronics.ru Git - kernel.git/commit
NFSD: Remove be32_to_cpu() from DRC hash function
authorChuck Lever <chuck.lever@oracle.com>
Thu, 30 Sep 2021 23:10:03 +0000 (19:10 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 13 Dec 2021 18:42:59 +0000 (13:42 -0500)
commit7f74a356bf27257cdc35337436c9435e27834fa8
tree5c034380b0eb3c31f47eeb37a669ec52ac00c44d
parentc86e40bc5ffdbb1c4309050f80bab3d2ba0d8b12
NFSD: Remove be32_to_cpu() from DRC hash function

Commit 36c99778949a ("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>
fs/nfsd/nfscache.c