]> git.proxmox.com Git - mirror_zfs.git/commit
Micro-optimize fletcher4 calculations
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Mon, 5 Dec 2022 19:00:34 +0000 (14:00 -0500)
committerGitHub <noreply@github.com>
Mon, 5 Dec 2022 19:00:34 +0000 (11:00 -0800)
commit59493b63c18ea223857066218d6a58b67eb88159
tree306345902afcc5b2c40eaccc21edeb638bdeb3c3
parent7b9a423076f4da36b68009ced22259cd243166f6
Micro-optimize fletcher4 calculations

When processing abds, we execute 1 `kfpu_begin()`/`kfpu_end()` pair on
every page in the abd. This is wasteful and slows down checksum
performance versus what the benchmark claimed. We correct this by moving
those calls to the init and fini functions.

Also, we always check the buffer length against 0 before calling the
non-scalar checksum functions. This means that we do not need to execute
the loop condition for the first loop iteration. That allows us to
micro-optimize the checksum calculations by switching to do-while loops.

Note that we do not apply that micro-optimization to the scalar
implementation because there is no check in
`fletcher_4_incremental_native()`/`fletcher_4_incremental_byteswap()`
against 0 sized buffers being passed.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14247
module/zcommon/zfs_fletcher_aarch64_neon.c
module/zcommon/zfs_fletcher_avx512.c
module/zcommon/zfs_fletcher_intel.c
module/zcommon/zfs_fletcher_sse.c
module/zcommon/zfs_fletcher_superscalar.c
module/zcommon/zfs_fletcher_superscalar4.c