Skip to contentSkip to conversation

scsi: iscsi: change back iscsi workqueue max_active argu to 1

PATCH Applied Bob Liu 3 participants 5 messages Jul 1, 2020 – Jul 3, 2020

Subsystems (2)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/2 scsi: iscsi: change back iscsi workqueue max_active argu to 1

Commit 3ce4196 (scsi: iscsi: Register sysfs for iscsi workqueue) enables 'cpumask' support for iscsi workqueues.

While there is a mistake in that commit, it's unnecessary to set max_active = 2 since 'cpumask' can be modified when max_active = 1.

This patch change back max_active to 1 so as to keep the same behaviour as before.

---
 drivers/scsi/libiscsi.c             | 2 +-
 drivers/scsi/scsi_transport_iscsi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +1 -1
index e5a64d4..49c8a18 100644
@@ -2629,7 +2629,7 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 			"iscsi_q_%d", shost->host_no);
 		ihost->workq = alloc_workqueue("%s",
 			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			2, ihost->workq_name);
+			1, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +1 -1
index f4cc08e..7ae5024 100644
@@ -4760,7 +4760,7 @@ static __init int iscsi_transport_init(void)
 
 	iscsi_eh_timer_workq = alloc_workqueue("%s",
 			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			2, "iscsi_eh");
+			1, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;
Signature · 1 line
2.9.5
author
#1 lore raw

PATCH 2/2 scsi: register sysfs for scsi workqueue

So that scsi_wq_xxx and scsi_tmf_xxx can be bind to different cpu to get better isolation.

This patch unfolded create_singlethread_workqueue(), added WQ_SYSFS and dropped __WQ_ORDERED_EXPLICIT since __WQ_ORDERED_EXPLICIT workqueue isn't allowed to change "cpumask".

---
 drivers/scsi/hosts.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +5 -3
index 7ec91c3..37d1c55 100644
@@ -272,8 +272,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	if (shost->transportt->create_work_queue) {
 		snprintf(shost->work_q_name, sizeof(shost->work_q_name),
 			 "scsi_wq_%d", shost->host_no);
-		shost->work_q = create_singlethread_workqueue(
-					shost->work_q_name);
+		shost->work_q = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			1, shost->work_q_name);
+
 		if (!shost->work_q) {
 			error = -EINVAL;
 			goto out_free_shost_data;
@@ -487,7 +489,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	}
 
 	shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
-					    WQ_UNBOUND | WQ_MEM_RECLAIM,
+					WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS,
 					   1, shost->host_no);
 	if (!shost->tmf_work_q) {
 		shost_printk(KERN_WARNING, shost,
Signature · 1 line
2.9.5
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] scsi: register sysfs for scsi workqueue

Quoted 31 lines · Bob Liu

So that scsi_wq_xxx and scsi_tmf_xxx can be bind to different cpu to get better isolation.

This patch unfolded create_singlethread_workqueue(), added WQ_SYSFS and dropped __WQ_ORDERED_EXPLICIT since __WQ_ORDERED_EXPLICIT workqueue isn't allowed to change "cpumask".

---
 drivers/scsi/hosts.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +4 -2
index 7ec91c3..37d1c55 100644
@@ -272,8 +272,10 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	if (shost->transportt->create_work_queue) {
 		snprintf(shost->work_q_name, sizeof(shost->work_q_name),
 			 "scsi_wq_%d", shost->host_no);
-		shost->work_q = create_singlethread_workqueue(
-					shost->work_q_name);
+		shost->work_q = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			1, shost->work_q_name);
+
 		if (!shost->work_q) {
 			error = -EINVAL;
 			goto out_free_shost_data;

drivers/scsi/hosts.c struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · line 495

Quoted 8 lines
drivers/scsi/hosts.c +1 -1
@@ -487,7 +489,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	}
 
 	shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
-					    WQ_UNBOUND | WQ_MEM_RECLAIM,
+					WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS,
 					   1, shost->host_no);
 	if (!shost->tmf_work_q) {
 		shost_printk(KERN_WARNING, shost,
maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Bob Liu
Quoted 34 lines · Bob Liu

Commit 3ce4196 (scsi: iscsi: Register sysfs for iscsi workqueue) enables 'cpumask' support for iscsi workqueues.

While there is a mistake in that commit, it's unnecessary to set max_active = 2 since 'cpumask' can be modified when max_active = 1.

This patch change back max_active to 1 so as to keep the same behaviour as before.

---
 drivers/scsi/libiscsi.c             | 2 +-
 drivers/scsi/scsi_transport_iscsi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +1 -1
index e5a64d4..49c8a18 100644
@@ -2629,7 +2629,7 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 			"iscsi_q_%d", shost->host_no);
 		ihost->workq = alloc_workqueue("%s",
 			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			2, ihost->workq_name);
+			1, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +0 -0
index f4cc08e..7ae5024 100644

drivers/scsi/scsi_transport_iscsi.c static __init int iscsi_transport_init(void) · line 4766

Quoted 8 lines
drivers/scsi/scsi_transport_iscsi.c +1 -1
@@ -4760,7 +4760,7 @@ static __init int iscsi_transport_init(void)
 
 	iscsi_eh_timer_workq = alloc_workqueue("%s",
 			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
-			2, "iscsi_eh");
+			1, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;

I think it should get it into 5.8 to fix the bug I mentioned in the other thread.

For 5.9, you'll want to send another patch to update the iscsi_destroy_workq that got added in 5.8.

scsi_transport_iscsi.c:

iscsi_destroy_workq = create_singlethread_workqueue("iscsi_destroy");

#4 lore raw
In reply to Bob Liu
Quoted 8 lines · Bob Liu

Commit 3ce4196 (scsi: iscsi: Register sysfs for iscsi workqueue) enables 'cpumask' support for iscsi workqueues.

While there is a mistake in that commit, it's unnecessary to set max_active = 2 since 'cpumask' can be modified when max_active = 1.

This patch change back max_active to 1 so as to keep the same behaviour as before.

Applied to 5.8/scsi-fixes, thanks!

[1/2] scsi: iscsi: Change iSCSI workqueue max_active back to 1

      https://git.kernel.org/mkp/scsi/c/1a9826204109
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering