Skip to contentSkip to conversation

net/mlx5_core/pagealloc: Remove deprecated create_singlethread_workqueue

PATCH In review Bhaktipriya Shridhar 4 participants 8 messages Jul 28, 2016 – Aug 2, 2016

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

PATCH 1/1 net/mlx5_core/pagealloc: Remove deprecated create_singlethread_workqueue

A dedicated workqueue has been used since the work items are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to guarantee forward progress under memory pressure.

The workqueue has a single work item. Hence, alloc_workqueue() is used instead of alloc_ordered_workqueue() since ordering is unnecessary when there's only one work item.

Explicit concurrency limit is unnecessary here since there are only a fixed number of work items.

---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +2 -1
index 9eeee05..7c85262 100644
@@ -552,7 +552,8 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev)
 
 int mlx5_pagealloc_start(struct mlx5_core_dev *dev)
 {
-	dev->priv.pg_wq = create_singlethread_workqueue("mlx5_page_allocator");
+	dev->priv.pg_wq = alloc_workqueue("mlx5_page_allocator",
+					  WQ_MEM_RECLAIM, 0);
 	if (!dev->priv.pg_wq)
 		return -ENOMEM;
 

--
2.1.4

#1 lore raw
Quoted 8 lines · Bhaktipriya Shridhar

A dedicated workqueue has been used since the work items are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to guarantee forward progress under memory pressure.

The workqueue has a single work item. Hence, alloc_workqueue() is used instead of alloc_ordered_workqueue() since ordering is unnecessary when there's only one work item.

Quoted 7 lines

Explicit concurrency limit is unnecessary here since there are only a fixed number of work items.

---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Hi Bhaktipriya,

First of all, I would like to thank you for your work and invite you to continue, but can you please submit ONE patch SERIES which changes all similar places?

BTW,
Did you test this patch? Did you notice the memory reclaim path nature of this work?

Thanks

Quoted 22 lines
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +2 -2
index 9eeee05..7c85262 100644
@@ -552,7 +552,8 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev)
 
 int mlx5_pagealloc_start(struct mlx5_core_dev *dev)
 {
-	dev->priv.pg_wq = create_singlethread_workqueue("mlx5_page_allocator");
+	dev->priv.pg_wq = alloc_workqueue("mlx5_page_allocator",
+					  WQ_MEM_RECLAIM, 0);
 	if (!dev->priv.pg_wq)
 		return -ENOMEM;
 
--

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

#7 lore raw
In reply to Bhaktipriya Shridhar
Quoted 7 lines · Bhaktipriya Shridhar

A dedicated workqueue has been used since the work items are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to guarantee forward progress under memory pressure.

The workqueue has a single work item. Hence, alloc_workqueue() is used instead of alloc_ordered_workqueue() since ordering is unnecessary when there's only one work item.

let's keep the current behavior (ST WQ) because at the moment we don't know how this WQ will evolve in the future, the original author had something in mind .. let's keep.

Quoted 26 lines

Explicit concurrency limit is unnecessary here since there are only a fixed number of work items.

---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +2 -2
index 9eeee05..7c85262 100644
@@ -552,7 +552,8 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev)
 
 int mlx5_pagealloc_start(struct mlx5_core_dev *dev)
 {
-       dev->priv.pg_wq = create_singlethread_workqueue("mlx5_page_allocator");
+       dev->priv.pg_wq = alloc_workqueue("mlx5_page_allocator",
+                                         WQ_MEM_RECLAIM, 0);
        if (!dev->priv.pg_wq)
                return -ENOMEM;
 
--

2.1.4

Quoted 4 lines

--
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

--
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
In reply to Leon Romanovsky
Quoted 17 lines · Leon Romanovsky
Quoted 8 lines · Bhaktipriya Shridhar

A dedicated workqueue has been used since the work items are being used on a memory reclaim path. WQ_MEM_RECLAIM has been set to guarantee forward progress under memory pressure.

The workqueue has a single work item. Hence, alloc_workqueue() is used instead of alloc_ordered_workqueue() since ordering is unnecessary when there's only one work item.

Quoted 7 lines

Explicit concurrency limit is unnecessary here since there are only a fixed number of work items.

---
 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 6 lines

Hi Bhaktipriya,

First of all, I would like to thank you for your work and invite you to continue, but can you please submit ONE patch SERIES which changes all similar places?

I agree with Leon, please push one series for all mlx5 patches and add some explanation in the cover letter regarding the motivation of this work.

Quoted 21 lines

BTW,
Did you test this patch? Did you notice the memory reclaim path nature of this work?

Thanks

Quoted 15 lines
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +2 -1
index 9eeee05..7c85262 100644
@@ -552,7 +552,8 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev)
 
 int mlx5_pagealloc_start(struct mlx5_core_dev *dev)
 {
-     dev->priv.pg_wq = create_singlethread_workqueue("mlx5_page_allocator");
+     dev->priv.pg_wq = alloc_workqueue("mlx5_page_allocator",
+                                       WQ_MEM_RECLAIM, 0);
      if (!dev->priv.pg_wq)
              return -ENOMEM;
 
Quoted 7 lines
Quoted 7 lines

--
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

--
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

#3 lore raw
In reply to Leon Romanovsky

Hello,

Quoted 2 lines · Leon Romanovsky

Did you test this patch? Did you notice the memory reclaim path nature of this work?

The conversion uses WQ_MEM_RECLAIM, which is standard for all workqueues which can stall packet processing if stalled. The requirement comes from nfs or block devices over network.

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
#4 lore raw
Quoted 9 lines · Tejun Heo

Hello,

Quoted 2 lines · Leon Romanovsky

Did you test this patch? Did you notice the memory reclaim path nature of this work?

The conversion uses WQ_MEM_RECLAIM, which is standard for all workqueues which can stall packet processing if stalled. The requirement comes from nfs or block devices over network.

The title stays "remove deprecated create_singlethread_workqueue" and if we put aside the word "deprecated", the code moves from ordered workqueue to unordered workqueue and changes max_active count which isn't expressed in commit message.

For reclaim paths, I want to be extra caution and want to see justification for doing that along with understanding if it is tested or not.

Right now, I'm feeling that I'm participating in soapie where one sends patch for every line, waits and sends the same patch for another file. It is worth to send one patch set and let us to test it all in once.

Thanks.

Quoted 9 lines

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
#5 lore raw

Hello, Leon.

Quoted 8 lines · Leon Romanovsky
Quoted 3 lines

The conversion uses WQ_MEM_RECLAIM, which is standard for all workqueues which can stall packet processing if stalled. The requirement comes from nfs or block devices over network.

The title stays "remove deprecated create_singlethread_workqueue" and if we put aside the word "deprecated", the code moves from ordered workqueue to unordered workqueue and changes max_active count which isn't expressed in commit message.

Maybe it was too compressed but the description says

"The workqueue has a single work item. Hence, alloc_workqueue() is
used instead of alloc_ordered_workqueue() since ordering is unnecessary when there's only one work item."

There's only one work item so whether the workqueue is ordered and its concurrency level don't make any difference. The reason why people used to use create_singlethread_workqueue() in these situations was because per-cpu workqueues used to be very expensive which isn't true anymore.

Quoted 3 lines

For reclaim paths, I want to be extra caution and want to see justification for doing that along with understanding if it is tested or not.

WQ_MEM_RECLAIM maintains the behavior of the existing code and the requirement comes from network interfaces being used for nfs and transport for block devices and is universial to everything in network layer. The only test we can do here is removing it and pushing it really hard and see whether we can actually trigger deadlock, which it will under the right circumstances which may or may not be easy to replicate in test environments. I don't see many merits in doing this especially when the behavior doesn't change from the existing code.

Quoted 3 lines

Right now, I'm feeling that I'm participating in soapie where one sends patch for every line, waits and sends the same patch for another file. It is worth to send one patch set and let us to test it all in once.

Yeah, I guess it can be a bit annoying. Bhaktipriya, can you please group patches for meallnox?

Thanks.

Signature · 1 line
tejun
#6 lore raw
Quoted 6 lines · Tejun Heo
Quoted 3 lines

Right now, I'm feeling that I'm participating in soapie where one sends patch for every line, waits and sends the same patch for another file. It is worth to send one patch set and let us to test it all in once.

Yeah, I guess it can be a bit annoying. Bhaktipriya, can you please group patches for meallnox?

Please do.
Thanks.

Quoted 9 lines

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