Skip to contentSkip to conversation

IB/srp: Remove create_workqueue

RFC In review Bhaktipriya Shridhar 3 participants 7 messages Jun 7, 2016 – Jun 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 IB/srp: Remove create_workqueue

alloc_workqueue replaces deprecated create_workqueue().

A dedicated workqueue has been used since the workqueue srp_remove_wq with workitem &target->remove_work, is a work queue for the SRP target removal. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.

Is the workqueue being used on a memory reclaim path? Does it require WQ_MEM_RECLAIM?

Thanks.

---
 drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
index 646de17..1730d1f 100644
@@ -3685,7 +3685,7 @@ static int __init srp_init_module(void)
 		indirect_sg_entries = cmd_sg_entries;
 	}
 
-	srp_remove_wq = create_workqueue("srp_remove");
+	srp_remove_wq = alloc_workqueue("srp_remove", WQ_MEM_RECLAIM, 0);
 	if (!srp_remove_wq) {
 		ret = -ENOMEM;
 		goto out;

--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 11 lines · Bhaktipriya Shridhar

alloc_workqueue replaces deprecated create_workqueue().

A dedicated workqueue has been used since the workqueue srp_remove_wq with workitem &target->remove_work, is a work queue for the SRP target removal. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.

Is the workqueue being used on a memory reclaim path? Does it require WQ_MEM_RECLAIM?

Hello Bhaktipriya,

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 10 lines · Bart Van Assche
Quoted 9 lines · Bhaktipriya Shridhar

alloc_workqueue replaces deprecated create_workqueue().

A dedicated workqueue has been used since the workqueue srp_remove_wq with workitem &target->remove_work, is a work queue for the SRP target removal. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.

Quoted 8 lines
Quoted 2 lines

Is the workqueue being used on a memory reclaim path? Does it require WQ_MEM_RECLAIM?

Hello Bhaktipriya,

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

It should be able to use system_wq then.

Thanks for the explanation!

Signature · 1 line
tejun
#3 lore raw
Quoted 14 lines · Tejun Heo
Quoted 13 lines · Bart Van Assche
Quoted 11 lines · Bhaktipriya Shridhar

alloc_workqueue replaces deprecated create_workqueue().

A dedicated workqueue has been used since the workqueue srp_remove_wq with workitem &target->remove_work, is a work queue for the SRP target removal. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.

Is the workqueue being used on a memory reclaim path? Does it require WQ_MEM_RECLAIM?

Quoted 7 lines
Quoted 5 lines

Hello Bhaktipriya,

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

It should be able to use system_wq then.

No. I have tried that but that resulted in a deadlock.

Bart.

#4 lore raw
Quoted 17 lines · Bart Van Assche
Quoted 16 lines · Tejun Heo
Quoted 15 lines · Bart Van Assche
Quoted 11 lines · Bhaktipriya Shridhar

alloc_workqueue replaces deprecated create_workqueue().

A dedicated workqueue has been used since the workqueue srp_remove_wq with workitem &target->remove_work, is a work queue for the SRP target removal. WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
Since there are only a fixed number of work items, explicit concurrency limit is unnecessary here.

Is the workqueue being used on a memory reclaim path? Does it require WQ_MEM_RECLAIM?

Hello Bhaktipriya,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

It should be able to use system_wq then.

No. I have tried that but that resulted in a deadlock.

See also commit bcc059103591 for the details.

Bart.

#5 lore raw

Hello, Bart.

Quoted 9 lines · Bart Van Assche
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

It should be able to use system_wq then.

No. I have tried that but that resulted in a deadlock.

See also commit bcc059103591 for the details.

So, create_workqueue() limits concurrency to 1 per cpu and if you have a dependency between two work items and they get scheduled on the same cpu they can deadlock. system_wq doesn't have that restriction and should be fine, AFAICS.

Thanks!

Signature · 5 lines
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
Quoted 7 lines · Tejun Heo
Quoted 6 lines · Bart Van Assche
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

srp_remove_wq is used for SRP target port removal work only. This work is neither queued from inside a shrinker nor by the page writeback code so I think it is safe to drop WQ_MEM_RECLAIM.

It should be able to use system_wq then.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

No. I have tried that but that resulted in a deadlock.

See also commit bcc059103591 for the details.

So, create_workqueue() limits concurrency to 1 per cpu and if you have a dependency between two work items and they get scheduled on the same cpu they can deadlock. system_wq doesn't have that restriction and should be fine, AFAICS.

Agreed, as long as WQ_DFL_ACTIVE is not reduced from its current value (256) to a very low value (e.g. 1 or 2). This assumption should be documented but I'm not sure what the best way is to document this...

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html