drm/qxl: Remove deprecated create_singlethread_workqueue
authorBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Sat, 2 Jul 2016 11:02:09 +0000 (16:32 +0530)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 12 Jul 2016 12:44:23 +0000 (14:44 +0200)
System workqueues have been able to handle high level of concurrency
for a long time now and there's no reason to use dedicated workqueues
just to gain concurrency. Since the workqueue in the QXL graphics device
driver is involved in freeing and processing the release ring
(workitem &qdev->gc_workqxl, maps to gc_work which calls
qxl_garbage_collect) and is not being used on a memory reclaim path,
dedicated gc_queue has been replaced with the use of system_wq.

Unlike a dedicated per-cpu workqueue created with create_workqueue(),
system_wq allows multiple work items to overlap executions even on
the same CPU; however, a per-cpu workqueue doesn't have any CPU
locality or global ordering guarantees unless the target CPU is
explicitly specified and thus the increase of local concurrency
shouldn't make any difference.

flush_work() has been called in qxl_device_fini() to ensure that there
are no pending tasks while disconnecting the driver.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160702110209.GA3560@Karyakshetra
drivers/gpu/drm/qxl/qxl_cmd.c
drivers/gpu/drm/qxl/qxl_drv.h
drivers/gpu/drm/qxl/qxl_kms.c

index b5d4b41361bdf3d78575e60d9c95d0b9da23a0d6..04270f5d110cd3b6d85e5a758cfc8fb00359be8d 100644 (file)
@@ -203,7 +203,7 @@ qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *releas
 bool qxl_queue_garbage_collect(struct qxl_device *qdev, bool flush)
 {
        if (!qxl_check_idle(qdev->release_ring)) {
-               queue_work(qdev->gc_queue, &qdev->gc_work);
+               schedule_work(&qdev->gc_work);
                if (flush)
                        flush_work(&qdev->gc_work);
                return true;
index 3ad6604b34ce76972b52fc67c593b323eee2897f..8e633caa40787d48192292c8620272dd843946cd 100644 (file)
@@ -321,7 +321,6 @@ struct qxl_device {
        struct qxl_bo *current_release_bo[3];
        int current_release_bo_offset[3];
 
-       struct workqueue_struct *gc_queue;
        struct work_struct gc_work;
 
        struct drm_property *hotplug_mode_update_property;
index 12b8dff9dc8c3f62e9b2e248de3c0cc45766dd98..e642242728c0b236caa0b066786f6b26cd6c8cb3 100644 (file)
@@ -258,7 +258,6 @@ static int qxl_device_init(struct qxl_device *qdev,
                 (unsigned long)qdev->surfaceram_size);
 
 
-       qdev->gc_queue = create_singlethread_workqueue("qxl_gc");
        INIT_WORK(&qdev->gc_work, qxl_gc_work);
 
        return 0;
@@ -270,10 +269,7 @@ static void qxl_device_fini(struct qxl_device *qdev)
                qxl_bo_unref(&qdev->current_release_bo[0]);
        if (qdev->current_release_bo[1])
                qxl_bo_unref(&qdev->current_release_bo[1]);
-       flush_workqueue(qdev->gc_queue);
-       destroy_workqueue(qdev->gc_queue);
-       qdev->gc_queue = NULL;
-
+       flush_work(&qdev->gc_work);
        qxl_ring_free(qdev->command_ring);
        qxl_ring_free(qdev->cursor_ring);
        qxl_ring_free(qdev->release_ring);