diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-07-30 02:18:24 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-11 08:33:31 -0400 |
commit | fb1e75389bd06fd5987e9cda1b4e0305c782f854 (patch) | |
tree | 6658e13f80d4f6450f5a69c82d3bf1b590ecf234 | |
parent | 1f98a13f623e0ef666690a18c1250335fc6d7ef1 (diff) |
block: improve queue_should_plug() by looking at IO depths
Instead of just checking whether this device uses block layer
tagging, we can improve the detection by looking at the maximum
queue depth it has reached. If that crosses 4, then deem it a
queuing device.
This is important on high IOPS devices, since plugging hurts
the performance there (it can be as much as 10-15% of the sys
time).
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/blk-core.c | 11 | ||||
-rw-r--r-- | include/linux/blkdev.h | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 52559715cb90..93051d151635 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1146,7 +1146,7 @@ void init_request_from_bio(struct request *req, struct bio *bio) | |||
1146 | */ | 1146 | */ |
1147 | static inline bool queue_should_plug(struct request_queue *q) | 1147 | static inline bool queue_should_plug(struct request_queue *q) |
1148 | { | 1148 | { |
1149 | return !(blk_queue_nonrot(q) && blk_queue_tagged(q)); | 1149 | return !(blk_queue_nonrot(q) && blk_queue_queuing(q)); |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static int __make_request(struct request_queue *q, struct bio *bio) | 1152 | static int __make_request(struct request_queue *q, struct bio *bio) |
@@ -1857,8 +1857,15 @@ void blk_dequeue_request(struct request *rq) | |||
1857 | * and to it is freed is accounted as io that is in progress at | 1857 | * and to it is freed is accounted as io that is in progress at |
1858 | * the driver side. | 1858 | * the driver side. |
1859 | */ | 1859 | */ |
1860 | if (blk_account_rq(rq)) | 1860 | if (blk_account_rq(rq)) { |
1861 | q->in_flight[rq_is_sync(rq)]++; | 1861 | q->in_flight[rq_is_sync(rq)]++; |
1862 | /* | ||
1863 | * Mark this device as supporting hardware queuing, if | ||
1864 | * we have more IOs in flight than 4. | ||
1865 | */ | ||
1866 | if (!blk_queue_queuing(q) && queue_in_flight(q) > 4) | ||
1867 | set_bit(QUEUE_FLAG_CQ, &q->queue_flags); | ||
1868 | } | ||
1862 | } | 1869 | } |
1863 | 1870 | ||
1864 | /** | 1871 | /** |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 88edb62def82..98b45633a27e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -459,6 +459,7 @@ struct request_queue | |||
459 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ | 459 | #define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ |
460 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ | 460 | #define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */ |
461 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 461 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ |
462 | #define QUEUE_FLAG_CQ 16 /* hardware does queuing */ | ||
462 | 463 | ||
463 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 464 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
464 | (1 << QUEUE_FLAG_CLUSTER) | \ | 465 | (1 << QUEUE_FLAG_CLUSTER) | \ |
@@ -581,6 +582,7 @@ enum { | |||
581 | 582 | ||
582 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) | 583 | #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) |
583 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) | 584 | #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) |
585 | #define blk_queue_queuing(q) test_bit(QUEUE_FLAG_CQ, &(q)->queue_flags) | ||
584 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) | 586 | #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) |
585 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) | 587 | #define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) |
586 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | 588 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |