Skip to contentSkip to conversation

scsi: iscsi: register sysfs for iscsi workqueue

RFC PATCH Applied Bob Liu 3 participants 5 messages May 5, 2020 – May 27, 2020

Subsystems (2)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

RFC PATCH v2 1/1 scsi: iscsi: register sysfs for iscsi workqueue

Motivation:
This patch enable setting cpu affinity through "cpumask" for iscsi workqueues (iscsi_q_xx and iscsi_eh), so as to get performance isolation.

The max number of active worker was changed form 1 to 2, because "cpumask" of ordered workqueue isn't allowed to change.

Notes:
- Having 2 workers break the current ordering guarantees, please let me know if anyone depends on this.

- __WQ_LEGACY have to be left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)

---
 drivers/scsi/libiscsi.c             | 4 +++-
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +3 -1
index 70b99c0..adf9bb4 100644
@@ -2627,7 +2627,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 	if (xmit_can_sleep) {
 		snprintf(ihost->workq_name, sizeof(ihost->workq_name),
 			"iscsi_q_%d", shost->host_no);
-		ihost->workq = create_singlethread_workqueue(ihost->workq_name);
+		ihost->workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +3 -1
index dfc726f..bdbc4a2 100644
@@ -4602,7 +4602,9 @@ static __init int iscsi_transport_init(void)
 		goto unregister_flashnode_bus;
 	}
 
-	iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh");
+	iscsi_eh_timer_workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;
Signature · 1 line
2.9.5
#1 lore raw

Chris/Lee: Please review!

Quoted 50 lines

Motivation:
This patch enable setting cpu affinity through "cpumask" for iscsi workqueues (iscsi_q_xx and iscsi_eh), so as to get performance isolation.

The max number of active worker was changed form 1 to 2, because "cpumask" of ordered workqueue isn't allowed to change.

Notes:
- Having 2 workers break the current ordering guarantees, please let me know if anyone depends on this.

- __WQ_LEGACY have to be left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)

---
 drivers/scsi/libiscsi.c             | 4 +++-
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +3 -1
index 70b99c0..adf9bb4 100644
@@ -2627,7 +2627,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 	if (xmit_can_sleep) {
 		snprintf(ihost->workq_name, sizeof(ihost->workq_name),
 			"iscsi_q_%d", shost->host_no);
-		ihost->workq = create_singlethread_workqueue(ihost->workq_name);
+		ihost->workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +3 -1
index dfc726f..bdbc4a2 100644
@@ -4602,7 +4602,9 @@ static __init int iscsi_transport_init(void)
 		goto unregister_flashnode_bus;
 	}
 
-	iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh");
+	iscsi_eh_timer_workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
author
#2 lore raw
In reply to Bob Liu

friendly ping.

Quoted 51 lines · Bob Liu

Motivation:
This patch enable setting cpu affinity through "cpumask" for iscsi workqueues (iscsi_q_xx and iscsi_eh), so as to get performance isolation.

The max number of active worker was changed form 1 to 2, because "cpumask" of ordered workqueue isn't allowed to change.

Notes:
- Having 2 workers break the current ordering guarantees, please let me know if anyone depends on this.

- __WQ_LEGACY have to be left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)

---
 drivers/scsi/libiscsi.c             | 4 +++-
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +3 -1
index 70b99c0..adf9bb4 100644
@@ -2627,7 +2627,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 	if (xmit_can_sleep) {
 		snprintf(ihost->workq_name, sizeof(ihost->workq_name),
 			"iscsi_q_%d", shost->host_no);
-		ihost->workq = create_singlethread_workqueue(ihost->workq_name);
+		ihost->workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +3 -1
index dfc726f..bdbc4a2 100644
@@ -4602,7 +4602,9 @@ static __init int iscsi_transport_init(void)
 		goto unregister_flashnode_bus;
 	}
 
-	iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh");
+	iscsi_eh_timer_workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;
maintainer Reviewed-by
#3 lore raw
Quoted 46 lines · Bob Liu

friendly ping.

Quoted 43 lines · Bob Liu

Motivation:
This patch enable setting cpu affinity through "cpumask" for iscsi workqueues (iscsi_q_xx and iscsi_eh), so as to get performance isolation.

The max number of active worker was changed form 1 to 2, because "cpumask" of ordered workqueue isn't allowed to change.

Notes:
- Having 2 workers break the current ordering guarantees, please let me know if anyone depends on this.

- __WQ_LEGACY have to be left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)

---
 drivers/scsi/libiscsi.c             | 4 +++-
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/libiscsi.c +3 -1
index 70b99c0..adf9bb4 100644
@@ -2627,7 +2627,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
 	if (xmit_can_sleep) {
 		snprintf(ihost->workq_name, sizeof(ihost->workq_name),
 			"iscsi_q_%d", shost->host_no);
-		ihost->workq = create_singlethread_workqueue(ihost->workq_name);
+		ihost->workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, ihost->workq_name);
 		if (!ihost->workq)
 			goto free_host;
 	}
drivers/scsi/scsi_transport_iscsi.c +0 -0
index dfc726f..bdbc4a2 100644
@@ -4602,7 +4602,9 @@ static __init int iscsi_transport_init(void)
 		goto unregister_flashnode_bus;
 	}
 
Quoted 9 lines

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

Quoted 8 lines
drivers/scsi/scsi_transport_iscsi.c +3 -1
-	iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh");
+	iscsi_eh_timer_workq = alloc_workqueue("%s",
+			WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND,
+			2, "iscsi_eh");
 	if (!iscsi_eh_timer_workq) {
 		err = -ENOMEM;
 		goto release_nls;
#4 lore raw
In reply to Bob Liu
Quoted 8 lines · Bob Liu

Motivation:
This patch enable setting cpu affinity through "cpumask" for iscsi workqueues (iscsi_q_xx and iscsi_eh), so as to get performance isolation.

The max number of active worker was changed form 1 to 2, because "cpumask" of ordered workqueue isn't allowed to change.

[...]

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: iscsi: Register sysfs for iscsi workqueue

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