summaryrefslogtreecommitdiffstats
path: root/drivers/block/loop.h
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2015-08-17 10:31:48 +0800
committerJens Axboe <axboe@fb.com>2015-09-23 11:01:16 -0600
commite03a3d7a94e2485b6e2fa3fb630b9b3a30b65718 (patch)
treece0d022f49faefa5845da085c0dcd66ff72252f9 /drivers/block/loop.h
parent5b5e20f421c0b6d437b3dec13e53674161998d56 (diff)
downloadop-kernel-dev-e03a3d7a94e2485b6e2fa3fb630b9b3a30b65718.zip
op-kernel-dev-e03a3d7a94e2485b6e2fa3fb630b9b3a30b65718.tar.gz
block: loop: use kthread_work
The following patch will use dio/aio to submit IO to backing file, then it needn't to schedule IO concurrently from work, so use kthread_work for decreasing context switch cost a lot. For non-AIO case, single thread has been used for long long time, and it was just converted to work in v4.0, which has caused performance regression for fedora live booting already. In discussion[1], even though submitting I/O via work concurrently can improve random read IO throughput, meantime it might hurt sequential read IO performance, so better to restore to single thread behaviour. For the following AIO support, it is better to use multi hw-queue with per-hwq kthread than current work approach suppose there is so high performance requirement for loop. [1] http://marc.info/?t=143082678400002&r=1&w=2 Signed-off-by: Ming Lei <ming.lei@canonical.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block/loop.h')
-rw-r--r--drivers/block/loop.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/block/loop.h b/drivers/block/loop.h
index 25e8997..b6c7d21 100644
--- a/drivers/block/loop.h
+++ b/drivers/block/loop.h
@@ -14,7 +14,7 @@
#include <linux/blk-mq.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
-#include <linux/workqueue.h>
+#include <linux/kthread.h>
#include <uapi/linux/loop.h>
/* Possible states of device */
@@ -54,12 +54,10 @@ struct loop_device {
gfp_t old_gfp_mask;
spinlock_t lo_lock;
- struct workqueue_struct *wq;
- struct list_head write_cmd_head;
- struct work_struct write_work;
- bool write_started;
int lo_state;
struct mutex lo_ctl_mutex;
+ struct kthread_worker worker;
+ struct task_struct *worker_task;
struct request_queue *lo_queue;
struct blk_mq_tag_set tag_set;
@@ -67,7 +65,7 @@ struct loop_device {
};
struct loop_cmd {
- struct work_struct read_work;
+ struct kthread_work work;
struct request *rq;
struct list_head list;
};
OpenPOWER on IntegriCloud