scsi: register sysfs for scsi workqueue
PATCH 1/1 scsi: register sysfs for scsi workqueue
This patch enable setting cpu affinity through "cpumask" for scsi workqueues (scsi_wq_* and scsi_tmf_*), so as to get better isolation.
The max number of active worker was changed form 1 to 2, since "cpumask" of ordered workqueue isn't allowed to change.
__WQ_LEGACY was left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)
--- drivers/scsi/hosts.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/hosts.c +5 -4
@@ -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 , +2 , shost->work_q_name); +if (!shost->work_q) { error = -EINVAL ; goto out_free_shost_data;
@@ -487,8 +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 , -1 , shost->host_no); +WQ_SYSFS |WQ_UNBOUND |WQ_MEM_RECLAIM ,2 , shost->host_no);if (!shost->tmf_work_q) {shost_printk (KERN_WARNING , shost,"failed to create tmf workq\n" );
Signature · 1 line
2.9.5
Quoted 5 lines · Bob Liu
This patch enable setting cpu affinity through "cpumask" for scsi workqueues (scsi_wq_* and scsi_tmf_*), so as to get better isolation.
The max number of active worker was changed form 1 to 2, since "cpumask" of ordered workqueue isn't allowed to change.
Do we just want to set it to 0? For all users but iscsi we use it for scanning. With 0, we can multiple rports/sessions in parallel.
For iscsi we do scanning and also unbinding (target removal) from it. It looks like we have the big iscsi_host mutex, so it would not help.
For the fc drivers that only scan through the fc class, we look ok. I think we want to flush/cancel the specific scan work item instead of flushing the entire workqueue when we are only concerned with a specific port in fc_rport_final_delete (the host removal we want to still do the entire workqueue). I think we want to do the same in snic snic_tgt_del.
For zfcp, I have no idea. You should cc them.
Quoted 37 lines
__WQ_LEGACYwas left because of
23d11a5(workqueue: skip flush dependency checks for legacy workqueues)Signed-off-by Bob Liu <[email protected]>--- drivers/scsi/hosts.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/scsi/hosts.c +5
-4@@ -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 , +2 , shost->work_q_name); +if (!shost->work_q) { error = -EINVAL ; goto out_free_shost_data;@@ -487,8 +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 , -1 , shost->host_no); +WQ_SYSFS |WQ_UNBOUND |WQ_MEM_RECLAIM ,2 , shost->host_no);if (!shost->tmf_work_q) {shost_printk (KERN_WARNING , shost,"failed to create tmf workq\n" );