[PATCH 0/4] Optimize dm-verity using 2-way interleaved SHA-256 hashing

Eric Biggers
2025-10-14T21:17:06Z

This series makes dm-verity take advantage of the 2-way interleaved
SHA-256 hashing code that was added in 6.18. fsverity already does
this; this brings the same optimization to dm-verity. This increases
SHA-256 hashing throughput by up to 98% on x86_64 and 70% on arm64.

To make this possible, this series makes dm-verity use the SHA-256
library when the hash algorithm is SHA-256 (which it usually is). That
actually provides a ~2% performance improvement by itself, in addition
to the larger improvement from interleaved hashing on x86_64 and arm64.

As usual, I verified that 'verity-compat-test' still passes.

This series is targeting linux-dm/for-next.

Eric Biggers (4):
dm-verity: remove log message with shash driver name
dm-verity: use SHA-256 library for SHA-256
dm-verity: reduce scope of real and wanted digests
dm-verity: use 2-way interleaved SHA-256 hashing when supported

drivers/md/Kconfig | 1 +
drivers/md/dm-verity-fec.c | 21 ++--
drivers/md/dm-verity-fec.h | 5 +-
drivers/md/dm-verity-target.c | 203 +++++++++++++++++++++++++---------
drivers/md/dm-verity.h | 52 +++++----
5 files changed, 196 insertions(+), 86 deletions(-)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
--
2.51.0