scsi: iscsi: change back iscsi workqueue max_active argu to 1
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
@@ -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
@@ -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
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
@@ -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
Re: [PATCH 2/2] scsi: register sysfs for scsi workqueue
Quoted 31 lines · Bob Liu
So that
scsi_wq_xxxandscsi_tmf_xxxcan be bind to different cpu to get better isolation.This patch unfolded
create_singlethread_workqueue(), addedWQ_SYSFSand dropped__WQ_ORDERED_EXPLICITsince__WQ_ORDERED_EXPLICITworkqueue isn't allowed to change "cpumask".Signed-off-by Bob Liu <[email protected]>--- drivers/scsi/hosts.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/scsi/hosts.c +4
-2@@ -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,
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 whenmax_active= 1.This patch change back
max_activeto 1 so as to keep the same behaviour as before.Signed-off-by Bob Liu <[email protected]>--- 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@@ -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
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");
Martin K. Petersen
AppliedQuoted 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 whenmax_active= 1.This patch change back
max_activeto 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