linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: Remove create_singlethread_workqueue
@ 2016-07-16  8:20 Bhaktipriya Shridhar
  2016-07-18 23:41 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Bhaktipriya Shridhar @ 2016-07-16  8:20 UTC (permalink / raw)
  To: David Airlie; +Cc: dri-devel, linux-kernel, Tejun Heo

swap_queue was created to handle shrinking in low memory situations.
A separate workqueue was used in order to avoid other workqueue tasks
from being blocked since work items on swap_queue spend a lot of time
waiting for the GPU.

Since these long-running work items aren't involved in memory reclaim in
any way, system_long_wq has been used.

Work item has been flushed in ttm_mem_global_release() to ensure that
nothing is pending when the driver is disconnected.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
---
 drivers/gpu/drm/ttm/ttm_memory.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index a1803fb..b985482 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -366,7 +366,6 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
 	struct ttm_mem_zone *zone;

 	spin_lock_init(&glob->lock);
-	glob->swap_queue = create_singlethread_workqueue("ttm_swap");
 	INIT_WORK(&glob->work, ttm_shrink_work);
 	ret = kobject_init_and_add(
 		&glob->kobj, &ttm_mem_glob_kobj_type, ttm_get_kobj(), "memory_accounting");
@@ -412,9 +411,7 @@ void ttm_mem_global_release(struct ttm_mem_global *glob)
 	ttm_page_alloc_fini();
 	ttm_dma_page_alloc_fini();

-	flush_workqueue(glob->swap_queue);
-	destroy_workqueue(glob->swap_queue);
-	glob->swap_queue = NULL;
+	flush_work(&glob->work);
 	for (i = 0; i < glob->num_zones; ++i) {
 		zone = glob->zones[i];
 		kobject_del(&zone->kobj);
@@ -443,7 +440,7 @@ static void ttm_check_swapping(struct ttm_mem_global *glob)
 	spin_unlock(&glob->lock);

 	if (unlikely(needs_swapping))
-		(void)queue_work(glob->swap_queue, &glob->work);
+		(void)queue_work(system_long_wq, &glob->work);

 }

--
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/ttm: Remove create_singlethread_workqueue
  2016-07-16  8:20 [PATCH] drm/ttm: Remove create_singlethread_workqueue Bhaktipriya Shridhar
@ 2016-07-18 23:41 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-07-18 23:41 UTC (permalink / raw)
  To: Bhaktipriya Shridhar; +Cc: David Airlie, dri-devel, linux-kernel

On Sat, Jul 16, 2016 at 01:50:17PM +0530, Bhaktipriya Shridhar wrote:
> swap_queue was created to handle shrinking in low memory situations.
> A separate workqueue was used in order to avoid other workqueue tasks
> from being blocked since work items on swap_queue spend a lot of time
> waiting for the GPU.
> 
> Since these long-running work items aren't involved in memory reclaim in
> any way, system_long_wq has been used.
> 
> Work item has been flushed in ttm_mem_global_release() to ensure that
> nothing is pending when the driver is disconnected.
> 
> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-18 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-16  8:20 [PATCH] drm/ttm: Remove create_singlethread_workqueue Bhaktipriya Shridhar
2016-07-18 23:41 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).