Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1407667 > unrolled thread
| Started by | Bhaktipriya Shridhar <bhaktipriya96@gmail.com> |
|---|---|
| First post | 2016-05-26 20:50 +0200 |
| Last post | 2016-05-26 21:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] gpu: drm: amd: amdkfd: Remove create_workqueue() Bhaktipriya Shridhar <bhaktipriya96@gmail.com> - 2016-05-26 20:50 +0200
Re: [PATCH] gpu: drm: amd: amdkfd: Remove create_workqueue() Tejun Heo <tj@kernel.org> - 2016-05-26 21:00 +0200
| From | Bhaktipriya Shridhar <bhaktipriya96@gmail.com> |
|---|---|
| Date | 2016-05-26 20:50 +0200 |
| Subject | [PATCH] gpu: drm: amd: amdkfd: Remove create_workqueue() |
| Message-ID | <rD8w2-1sN-19@gated-at.bofh.it> |
alloc_workqueue replaces deprecated create_workqueue().
kfd_process_wq is used for delay destruction. A work item embedded in
kfd_process gets queued to kfd_process_wq and when it executes it
destroys and frees the containing kfd_process and thus itself.
This requires a dedicated workqueue because a work item once queued, may
get freed at any point of time and any external entity cannot
flush the work item. So, in order to wait for such a work item,
it needs to be put on a dedicated workqueue.
kfd_module_exit() calls kfd_process_destroy_wq which ensures that all
pending work items are finished before the module is removed.
flush_workqueue is unnecessary since destroy_workqueue() itself calls
drain_workqueue() which flushes repeatedly till the workqueue becomes empty.
Hence flush_workqueue has been removed.
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index ac00579..b21d3fc8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -63,13 +63,12 @@ static struct kfd_process *create_process(const struct task_struct *thread);
void kfd_process_create_wq(void)
{
if (!kfd_process_wq)
- kfd_process_wq = create_workqueue("kfd_process_wq");
+ kfd_process_wq = alloc_workqueue("kfd_process_wq",0,0);
}
void kfd_process_destroy_wq(void)
{
if (kfd_process_wq) {
- flush_workqueue(kfd_process_wq);
destroy_workqueue(kfd_process_wq);
kfd_process_wq = NULL;
}
--
2.1.4
[toc] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2016-05-26 21:00 +0200 |
| Message-ID | <rD8FI-1wa-31@gated-at.bofh.it> |
| In reply to | #1407667 |
On Fri, May 27, 2016 at 12:15:17AM +0530, Bhaktipriya Shridhar wrote: > alloc_workqueue replaces deprecated create_workqueue(). > > kfd_process_wq is used for delay destruction. A work item embedded in > kfd_process gets queued to kfd_process_wq and when it executes it > destroys and frees the containing kfd_process and thus itself. > > This requires a dedicated workqueue because a work item once queued, may > get freed at any point of time and any external entity cannot > flush the work item. So, in order to wait for such a work item, > it needs to be put on a dedicated workqueue. > > kfd_module_exit() calls kfd_process_destroy_wq which ensures that all > pending work items are finished before the module is removed. > > flush_workqueue is unnecessary since destroy_workqueue() itself calls > drain_workqueue() which flushes repeatedly till the workqueue becomes empty. > > Hence flush_workqueue has been removed. create_workqueue(NAME) maps to alloc_workqueue(NAME, WQ_MEM_RECLAIM, 1), so the change is effectively dropping WQ_MEM_RECLAIM and changing concurrency value from 1 to WQ_DFL_ACTIVE. It'd be nice to explain why these changes are safe and I think they're. It just needs explanations. > Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Other than that, Acked-by: Tejun Heo <tj@kernel.org> Thanks. -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web