]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dm-verity: use 2-way interleaved SHA-256 hashing when supported
authorEric Biggers <ebiggers@kernel.org>
Tue, 14 Oct 2025 21:16:57 +0000 (14:16 -0700)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 20 Oct 2025 13:47:42 +0000 (15:47 +0200)
commit23f57ed9d26e309010996a6809e410ed59c7ec7c
tree7739ae7f3407e721c117b38a6c1c46605391582b
parent379475dc88fc44f57760e6057b038073e352aaea
dm-verity: use 2-way interleaved SHA-256 hashing when supported

When the crypto library provides an optimized implementation of
sha256_finup_2x(), use it to interleave the hashing of pairs of data
blocks.  On some CPUs this nearly doubles hashing performance.  The
increase in overall throughput of cold-cache dm-verity reads that I'm
seeing on arm64 and x86_64 is roughly 35% (though this metric is hard to
measure as it jumps around a lot).

For now this is done only on data blocks, not Merkle tree blocks.  We
could use sha256_finup_2x() on Merkle tree blocks too, but that is less
important as there aren't as many Merkle tree blocks as data blocks, and
that would require some additional code restructuring.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-verity-target.c
drivers/md/dm-verity.h