diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2018-10-09 16:13:43 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-10-18 12:17:17 -0400 |
commit | ed0302e83098db9b3a8c27f36c93deeafd6963d8 (patch) | |
tree | 02b60bc463ddeacfbc9e004db986e48205f1ba3c | |
parent | f349b0a3e1f0d184374936f1b2a49352f8a4b1c8 (diff) |
dm crypt: make workqueue names device-specific
Make cpu-usage debugging easier by naming workqueues per device.
Example ps output:
root 413 0.0 0.0 0 0 ? I< paź02 0:00 [kcryptd_io/253:0]
root 414 0.0 0.0 0 0 ? I< paź02 0:00 [kcryptd/253:0]
root 415 0.0 0.0 0 0 ? S paź02 1:10 [dmcrypt_write/253:0]
root 465 0.0 0.0 0 0 ? I< paź02 0:00 [kcryptd_io/253:2]
root 466 0.0 0.0 0 0 ? I< paź02 0:00 [kcryptd/253:2]
root 467 0.0 0.0 0 0 ? S paź02 2:06 [dmcrypt_write/253:2]
root 15359 0.2 0.0 0 0 ? I< 19:43 0:25 [kworker/u17:8-kcryptd/253:0]
root 16563 0.2 0.0 0 0 ? I< 20:10 0:18 [kworker/u17:0-kcryptd/253:2]
root 23205 0.1 0.0 0 0 ? I< 21:21 0:04 [kworker/u17:4-kcryptd/253:0]
root 13383 0.1 0.0 0 0 ? I< 21:32 0:02 [kworker/u17:2-kcryptd/253:2]
root 2610 0.1 0.0 0 0 ? I< 21:42 0:01 [kworker/u17:12-kcryptd/253:2]
root 20124 0.1 0.0 0 0 ? I< 21:56 0:01 [kworker/u17:1-kcryptd/253:2]
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | drivers/md/dm-crypt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 0481223b1deb..b8eec515a003 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -2661,6 +2661,7 @@ static int crypt_ctr_optional(struct dm_target *ti, unsigned int argc, char **ar | |||
2661 | static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | 2661 | static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
2662 | { | 2662 | { |
2663 | struct crypt_config *cc; | 2663 | struct crypt_config *cc; |
2664 | const char *devname = dm_table_device_name(ti->table); | ||
2664 | int key_size; | 2665 | int key_size; |
2665 | unsigned int align_mask; | 2666 | unsigned int align_mask; |
2666 | unsigned long long tmpll; | 2667 | unsigned long long tmpll; |
@@ -2806,18 +2807,22 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
2806 | } | 2807 | } |
2807 | 2808 | ||
2808 | ret = -ENOMEM; | 2809 | ret = -ENOMEM; |
2809 | cc->io_queue = alloc_workqueue("kcryptd_io", WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); | 2810 | cc->io_queue = alloc_workqueue("kcryptd_io/%s", |
2811 | WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, | ||
2812 | 1, devname); | ||
2810 | if (!cc->io_queue) { | 2813 | if (!cc->io_queue) { |
2811 | ti->error = "Couldn't create kcryptd io queue"; | 2814 | ti->error = "Couldn't create kcryptd io queue"; |
2812 | goto bad; | 2815 | goto bad; |
2813 | } | 2816 | } |
2814 | 2817 | ||
2815 | if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags)) | 2818 | if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags)) |
2816 | cc->crypt_queue = alloc_workqueue("kcryptd", WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1); | 2819 | cc->crypt_queue = alloc_workqueue("kcryptd/%s", |
2820 | WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, | ||
2821 | 1, devname); | ||
2817 | else | 2822 | else |
2818 | cc->crypt_queue = alloc_workqueue("kcryptd", | 2823 | cc->crypt_queue = alloc_workqueue("kcryptd/%s", |
2819 | WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, | 2824 | WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, |
2820 | num_online_cpus()); | 2825 | num_online_cpus(), devname); |
2821 | if (!cc->crypt_queue) { | 2826 | if (!cc->crypt_queue) { |
2822 | ti->error = "Couldn't create kcryptd queue"; | 2827 | ti->error = "Couldn't create kcryptd queue"; |
2823 | goto bad; | 2828 | goto bad; |
@@ -2826,7 +2831,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
2826 | spin_lock_init(&cc->write_thread_lock); | 2831 | spin_lock_init(&cc->write_thread_lock); |
2827 | cc->write_tree = RB_ROOT; | 2832 | cc->write_tree = RB_ROOT; |
2828 | 2833 | ||
2829 | cc->write_thread = kthread_create(dmcrypt_write, cc, "dmcrypt_write"); | 2834 | cc->write_thread = kthread_create(dmcrypt_write, cc, "dmcrypt_write/%s", devname); |
2830 | if (IS_ERR(cc->write_thread)) { | 2835 | if (IS_ERR(cc->write_thread)) { |
2831 | ret = PTR_ERR(cc->write_thread); | 2836 | ret = PTR_ERR(cc->write_thread); |
2832 | cc->write_thread = NULL; | 2837 | cc->write_thread = NULL; |