BACKPORT: FROMLIST: dm-verity: improve performance by using multibuffer hashing
When supported by the hash algorithm, use crypto_shash_finup_mb() 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 only done on data blocks, not Merkle tree blocks. We could use finup_mb 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. Reviewed-by:Sami Tolvanen <samitolvanen@google.com> Acked-by:
Ard Biesheuvel <ardb@kernel.org> Signed-off-by:
Eric Biggers <ebiggers@google.com> Bug: 330611177 Link: https://lore.kernel.org/r/20240621165922.77672-16-ebiggers@kernel.org (resolved conflict due to missing the upstream commit "dm-verity: Convert from tasklet to BH workqueue", which is hard to cherry-pick because it depends on workqueue subsystem changes) Change-Id: I5a2ee7af05b53e30a3bc8a1e1ffc77a5244cb38d Signed-off-by:
Eric Biggers <ebiggers@google.com>
Loading
Please sign in to comment