git: dm_target_crypt_ng - Remove worker pool
Michael Neumann
mneumann at crater.dragonflybsd.org
Wed Apr 9 11:57:35 PDT 2025
commit 6771a78a0fda8c121ca57414c7faeed7e42d3ffa
Author: Michael Neumann <mneumann at ntecs.de>
Date: Wed Apr 9 11:25:42 2025 +0200
dm_target_crypt_ng - Remove worker pool
No longer use a worker pool to distribute read/write BIOs to worker
threads. Go back to the callback approach of the original
dm_target_crypt implementation, except that encryption and decryption
are now done synchronously (or in the mpipe callback).
This commit makes the code simpler and also slightly improves
performance over the worker pool implementation. My prior statement
about much better interactivity when running "blogbench" with the new
implementation could not be confirmed - sometimes interactivity was
great, sometimes bad and sometimes the final results of blogbench were
just 50% of those of better days.
In the following, I compared three different implementations:
* old: old dm_target_crypt
* ng_wp: dm_target_crypt_ng with worker pool
* ng_sync: dm_target_crypt_ng w/o worker pool (this commit)
See below for some benchmarks.
---------------------------------------
Benchmark 1 - write/encrypt performance
---------------------------------------
Test write/encrypt performance by copying a ~800 MB file from
unencrypted fs to encrypted fs (aes-cbc):
time cp /usr/obj/huge.mov /crypt
Results:
Implementation Time Throughput
old 54 s 146 MB/s
ng_wp 43 s 184 MB/s (+ 26%)
ng_sync 40 s 198 MB/s (+ 35%)
--------------------------------------
Benchmark 2 - read/decrypt performance
--------------------------------------
Test read/decrypt performance by reading a ~800 MB file on encrypted
fs (aes-cbc):
time cat /crypt/huge2.mov > /dev/null
Results:
Implementation Time Throughput
old 50 s 158 MB/s
ng_wp 27 s 293 MB/s (+ 85%)
ng_sync 24 s 330 MB/s (+ 108%)
---------------------------------------------
Benchmark 3 - raw encrypt performance aes-cbc
---------------------------------------------
Test raw encrypt performance by copying a file to a ~1 GB
tempfs-backed raw dm-crypt disk using aes-cbc (*).
Results:
Implementation Time Throughput
old 3.6 s 274 MB/s
ng_wp 2.4 s 414 MB/s (+ 51%)
ng_sync 1.8 s 537 MB/s (+ 95%)
---------------------------------------------
Benchmark 4 - raw encrypt performance aes-xts
---------------------------------------------
Test raw encrypt performance by copying a file to a ~1 GB
tempfs-backed raw dm-crypt disk using aes-xts (*).
Results:
Implementation Time Throughput
old 6.5 s 153 MB/s
ng_wp 4.6 s 215 MB/s (+ 40%)
ng_sync 4.1 s 240 MB/s (+ 56%)
---------------------------------------
(*) The following script is used:
dd if=/dev/zero of=/tmp/diskimage bs=1m count=1000
vnconfig -c vn0 /tmp/diskimage
echo "password" > /tmp/keyfile
cryptsetup luksFormat --cipher aes-cbc-essiv:sha256 /dev/vn0 /tmp/keyfile
# or
# cryptsetup luksFormat --cipher aes-xts-essiv:sha256 /dev/vn0 /tmp/keyfile
cryptsetup luksOpen --key-file /tmp/keyfile /dev/vn0 testdisk
cat /usr/obj/video1g.mov > /dev/null
time dd if=/usr/obj/video1g.mov of=/dev/mapper/testdisk conv=sync bs=1m
cryptsetup luksClose testdisk
vnconfig -u vn0
Summary of changes:
sys/dev/disk/dm/crypt_ng/Makefile | 1 -
sys/dev/disk/dm/crypt_ng/dm_target_crypt.c | 288 +++++++++++++++++------------
sys/dev/disk/dm/crypt_ng/worker_pool.c | 258 --------------------------
sys/dev/disk/dm/crypt_ng/worker_pool.h | 160 ----------------
4 files changed, 166 insertions(+), 541 deletions(-)
delete mode 100644 sys/dev/disk/dm/crypt_ng/worker_pool.c
delete mode 100644 sys/dev/disk/dm/crypt_ng/worker_pool.h
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/6771a78a0fda8c121ca57414c7faeed7e42d3ffa
--
DragonFly BSD source repository
More information about the Commits
mailing list