-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples/kdigest: add AF_ALG hash example #336
Conversation
v1 was submitted via #335 . |
6a39cb3
to
4dc3c61
Compare
Changes since previous version:
|
@isilence any further thoughts on this patch, or should I drop it? |
@axboe feel free to close if there's no interest in this change. |
I don't really mind it get merged if it's sane enough, but apparently nobody just have time to take a look. I'd rather assume it to stay until then |
@ddiss Were you planning on respinning this change? |
Thanks for the ping. Yes, the respin is still on my todo list, but some other things got in the way. I'm hoping to return to this in a few weeks. I'll close here for now and reopen when ready. |
I finally got a chance to revisit this, so will post an update here, hopefully addressing Pavel's feedback. |
3f9e67c
to
017801f
Compare
changes since 2021:
|
Thanks for picking this up again! Can you address the CI failures? Looks like it's just basic complaints on things that should be static. I think this would be a good example to add. |
When built with CONFIG_CRYPTO_USER_API_HASH enabled, Linux exposes a socket based API for hashing data. When coupled with uring IOSQE_IO_LINK, file hashing can be done in quite an efficient manner, as demonstrated in this example. Signed-off-by: David Disseldorp <[email protected]>
017801f
to
97e10b6
Compare
changes to address CI failures:
|
Thanks! |
Rather than use |
That adds bundled sends. Didn't test it much, but seems to work. |
Ran a quick test on an amd box, and I ranges from ~5x faster at the lower sizes, to being even for 16MB/32MB. Ran your test on it. So whether that helped or not, not sure, but at least it's no longer slower for bigger sizes and it's still considerably faster for sizes that people would actually use. |
Thanks for the follow up changes. FWIW, I did play around with merging buffers for the send, but didn't see much perf improvement for the added complexity. Bundling looks good. |
Right, with bundles it's just as easy as using links, at least. But I like having both in the example, as it shows how to use either one. |
In case anyone is interested, below are some rough kdigest ( c90e5a6 ) perf measurements: kdigest-c90e5a6
openssl-3.1.4-3.2
Benchmark script: for size in $((32 * 1024 * 1024)) $((16 * 1024 * 1024)) $((1024 * 1024)) \
$((64 * 1024)) $((4 * 1024)) 512; do
dd if=/dev/urandom of="${size}.data" bs="$size" count=1 || break
echo "==== hashing file of size $size ===="
for i in md5 sha1 sha224 sha256 sha384 sha512; do
# prime cache
cat "${size}.data" > /dev/null
perf stat --null -r 5 --table openssl "$i" "${size}.data" >/dev/null 2>openssl.${size}.${i}.perf
perf stat --null -r 5 --table ~/liburing/examples/kdigest "$i" "${size}.data" >/dev/null 2>kdigest.${size}.${i}.perf
done
done Host details:
|
When built with CONFIG_CRYPTO_USER_API_HASH enabled, Linux exposes a
socket based API for hashing data. When coupled with uring
IOSQE_IO_LINK, file hashing can be done in quite an efficient manner,
as demonstrated in this link-cp.c based example.
Signed-off-by: David Disseldorp [email protected]