diff mbox series

[2/2] dm integrity: mark workqueues with device they belong to

Message ID 21a208d4b72f04a75cc5f4a81e3402dd13fadad7.1641857023.git.mirq-linux@rere.qmqm.pl (mailing list archive)
State New, archived
Headers show
Series [1/2] dm integrity: use alloc_ordered_workqueue() for dm-integrity-wait | expand

Commit Message

Michał Mirosław Jan. 10, 2022, 11:25 p.m. UTC
Add device name to workqueue names to help debugging CPU usage per
device mapper target.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/md/dm-integrity.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 6dc9aebf8487..cd60488938ea 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -3958,6 +3958,7 @@  static int create_journal(struct dm_integrity_c *ic, char **error)
  */
 static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 {
+	const char *devname = dm_table_device_name(ti->table);
 	struct dm_integrity_c *ic;
 	char dummy;
 	int r;
@@ -4200,8 +4201,8 @@  static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 		goto bad;
 	}
 
-	ic->metadata_wq = alloc_workqueue("dm-integrity-metadata",
-					  WQ_MEM_RECLAIM, METADATA_WORKQUEUE_MAX_ACTIVE);
+	ic->metadata_wq = alloc_workqueue("dm-integrity-metadata/%s", WQ_MEM_RECLAIM,
+					  METADATA_WORKQUEUE_MAX_ACTIVE, devname);
 	if (!ic->metadata_wq) {
 		ti->error = "Cannot allocate workqueue";
 		r = -ENOMEM;
@@ -4212,22 +4213,22 @@  static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	 * If this workqueue were percpu, it would cause bio reordering
 	 * and reduced performance.
 	 */
-	ic->wait_wq = alloc_ordered_workqueue("dm-integrity-wait", WQ_MEM_RECLAIM);
+	ic->wait_wq = alloc_ordered_workqueue("dm-integrity-wait/%s", WQ_MEM_RECLAIM, devname);
 	if (!ic->wait_wq) {
 		ti->error = "Cannot allocate workqueue";
 		r = -ENOMEM;
 		goto bad;
 	}
 
-	ic->offload_wq = alloc_workqueue("dm-integrity-offload", WQ_MEM_RECLAIM,
-					  METADATA_WORKQUEUE_MAX_ACTIVE);
+	ic->offload_wq = alloc_workqueue("dm-integrity-offload/%s", WQ_MEM_RECLAIM,
+					  METADATA_WORKQUEUE_MAX_ACTIVE, devname);
 	if (!ic->offload_wq) {
 		ti->error = "Cannot allocate workqueue";
 		r = -ENOMEM;
 		goto bad;
 	}
 
-	ic->commit_wq = alloc_workqueue("dm-integrity-commit", WQ_MEM_RECLAIM, 1);
+	ic->commit_wq = alloc_workqueue("dm-integrity-commit/%s", WQ_MEM_RECLAIM, 1, devname);
 	if (!ic->commit_wq) {
 		ti->error = "Cannot allocate workqueue";
 		r = -ENOMEM;
@@ -4236,7 +4237,7 @@  static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	INIT_WORK(&ic->commit_work, integrity_commit);
 
 	if (ic->mode == 'J' || ic->mode == 'B') {
-		ic->writer_wq = alloc_workqueue("dm-integrity-writer", WQ_MEM_RECLAIM, 1);
+		ic->writer_wq = alloc_workqueue("dm-integrity-writer/%s", WQ_MEM_RECLAIM, 1, devname);
 		if (!ic->writer_wq) {
 			ti->error = "Cannot allocate workqueue";
 			r = -ENOMEM;
@@ -4395,7 +4396,7 @@  static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 	}
 
 	if (ic->internal_hash) {
-		ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", WQ_MEM_RECLAIM, 1);
+		ic->recalc_wq = alloc_workqueue("dm-integrity-recalc/%s", WQ_MEM_RECLAIM, 1, devname);
 		if (!ic->recalc_wq ) {
 			ti->error = "Cannot allocate workqueue";
 			r = -ENOMEM;