dm-verity: Enable WQ_HIGHPRI
PATCH 1/1 dm-verity: Enable WQ_HIGHPRI
WQ_HIGHPRI increases throughput and decreases disk latency when using dm-verity. This is important in Android for camera startup speed.
The following tests were run by doing 60 seconds of random reads using a dm-verity device backed by two ramdisks.
With WQ_HIGHPRI:
lat (usec): min=13, max=7854, avg=31.15, stdev=30.42
READ: bw=116MiB/s (121MB/s), 116MiB/s-116MiB/s (121MB/s-121MB/s)
Without WQ_HIGHPRI
lat (usec): min=13, max=3947, avg=69.53, stdev=50.55
READ: bw=51.1MiB/s (53.6MB/s), 51.1MiB/s-51.1MiB/s (53.6MB/s-53.6MB/s)
Further testing was done by measuring how long it takes to open a camera on an Android device.
With WQ_HIGHPRI:
Total verity work queue wait times (ms):
528.824, 439.191, 433.300
Without WQ_HIGHPRI
Total verity work queue wait times (ms):
880.960, 789.517, 898.852
The time it takes to open the camera is reduced by 350ms on average.
--- drivers/md/dm-verity-target.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/md/dm-verity-target.c +5 -8
@@ -1390,14 +1390,11 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)/* WQ_UNBOUND greatly improves performance when running on ramdisk */ wq_flags =WQ_MEM_RECLAIM |WQ_UNBOUND ; -if (v->use_tasklet) { -/* -* Allow verify_wq to preempt softirq since verification in -* tasklet will fall-back to using it for error handling -* (or if the bufio cache doesn't have required hashes). -*/ - wq_flags |=WQ_HIGHPRI ; - } +/* +* WQ_HIGHPRI reduces waiting times when reading from a dm-verity +* device. This improves throughput and completion latency. +*/ + wq_flags |=WQ_HIGHPRI ; v->verify_wq =alloc_workqueue ("kverityd" , wq_flags,num_online_cpus ());if (!v->verify_wq) { ti->error ="Cannot allocate workqueue" ;
Signature · 6 lines
2.37.2.672.g94769d06f0-goog -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel