Whamcloud - gitweb
LU-13127 ptlrpc: prefer crc32_le() over CryptoAPI 14/39614/4
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 11 Aug 2020 00:32:18 +0000 (18:32 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 1 Sep 2020 03:42:53 +0000 (03:42 +0000)
commit1dda0ef6a70b2c1f6b01054d851ace22e99bb048
treeac36adcac5a15c0a79c586db17c4fc44288e2dd6
parent4f192768293364c65411015de7531f62fdfb754c
LU-13127 ptlrpc: prefer crc32_le() over CryptoAPI

Prefer to call the crc32_le() library function directly if available,
instead of cfs_crypto_hash(CFS_HASH_ALG_CRC32). It is about 10x faster
for the 156-byte struct ptlrpc_body being checked in this function.
A test of small buffers in that compares the two implementations, run
on a 2.9GHz Core i7-7820 shows the difference is significant here:

  buffer size   156 bytes   1536 bytes   4096 bytes     1 MiB
  -----------+------------+------------+-----------+-----------
  cfs_crypto |  182 MiB/s | 1794 MiB/s | 4163 MB/s | 9631 MiB/s
  crc32_le   | 1947 MiB/s | 1871 MiB/s | 1867 MB/s | 1823 MiB/s

This corresponds to 10x faster or 1/10 as many cycles for ptlrpc_body.
The CryptoAPI speed crosses over around 1536 bytes, which is still 10x
larger than the ptlrpc_body size, so it is unlikely to be faster here.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I116fd6c148f15660dd7b7faefb86f9dd603ebbe5
Reviewed-on: https://review.whamcloud.com/39614
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/pack_generic.c