Commit 0c94038
committed
Merge: dm-crypt: limit the size of encryption requests
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4779
JIRA: https://issues.redhat.com/browse/RHEL-49548
Tested: cryptsetup tests and the bug reproducer
Upstream Status: kernel/git/device-mapper/linux-dm.git
commit 0d815e3
Author: Mikulas Patocka <mpatocka@redhat.com>
Date: Wed Jul 3 15:00:29 2024 +0200
dm-crypt: limit the size of encryption requests
There was a performance regression reported where dm-crypt would perform
worse on new kernels than on old kernels. The reason is that the old
kernels split the bios to NVMe request size (that is usually 65536 or
131072 bytes) and the new kernels pass the big bios through dm-crypt and
split them underneath.
If a big 1MiB bio is passed to dm-crypt, dm-crypt processes it on a single
core without parallelization and this is what causes the performance
degradation.
This commit introduces new tunable variables
/sys/module/dm_crypt/parameters/max_read_size and
/sys/module/dm_crypt/parameters/max_write_size that specify the maximum
bio size for dm-crypt. Bios larger than this value are split, so that
they can be encrypted in parallel by multiple cores. If these variables
are '0', a default 131072 is used.
Splitting bios may cause performance regressions in other workloads - if
this happens, the user should increase the value in max_read_size and
max_write_size variables.
max_read_size:
128k 2399MiB/s
256k 2368MiB/s
512k 1986MiB/s
1024 1790MiB/s
max_write_size:
128k 1712MiB/s
256k 1651MiB/s
512k 1537MiB/s
1024k 1332MiB/s
Note that if you run dm-crypt inside a virtual machine, you may need to do
"echo numa >/sys/module/workqueue/parameters/default_affinity_scope" to
improve performance.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Approved-by: Mikuláš Patočka <mpatocka@redhat.com>
Approved-by: John B. Wyatt IV <jwyatt@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>
Merged-by: Lucas Zampieri <lzampier@redhat.com>File tree
2 files changed
+40
-3
lines changed- Documentation/admin-guide/device-mapper
- drivers/md
2 files changed
+40
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
158 | 169 | | |
159 | 170 | | |
160 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
241 | 266 | | |
242 | 267 | | |
243 | 268 | | |
| |||
3435 | 3460 | | |
3436 | 3461 | | |
3437 | 3462 | | |
| 3463 | + | |
3438 | 3464 | | |
3439 | 3465 | | |
3440 | 3466 | | |
| |||
3453 | 3479 | | |
3454 | 3480 | | |
3455 | 3481 | | |
3456 | | - | |
3457 | | - | |
3458 | | - | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
3459 | 3485 | | |
3460 | 3486 | | |
3461 | 3487 | | |
| |||
0 commit comments