diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-04-12 00:16:32 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-04-12 00:16:32 -0700 |
| commit | 1dc841edc41a3014ece92b72013b3b57b0424e6b (patch) | |
| tree | 875a8efda047cbe1f66d2c7018826c44658d1f0b /include/linux | |
| parent | 66db15b4577185624ae95ffe99a66305c8c63ef7 (diff) | |
[PATCH] Correct unplugs on nr_queued
From: Jens Axboe <axboe@suse.de>
There's a small discrepancy in when we decide to unplug a queue based on
q->unplug_thresh. Basically it doesn't work for tagged queues, since
q->rq.count[READ] + q->rq.count[WRITE] is just the number of allocated
requests, not the number of requests stuck in the io scheduler. We could
just change the nr_queued == to a nr_queued >=, however that is still
suboptimal.
This patch adds accounting for requests that have been dequeued from the io
scheduler, but not freed yet. These are q->in_flight. allocated_requests
- q->in_flight == requests_in_scheduler. So the condition correctly
becomes
if (requests_in_scheduler == q->unplug_thresh)
instead. I did a quick round of testing, and for dbench on a SCSI disk the
number of timer induced unplugs was reduced from 13 to 5 :-). Not a huge
number, but there might be cases where it's more significant. Either way,
it gets ->unplug_thresh always right, which the old logic didn't.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/blkdev.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 572f96e6940a..44c722d4b67b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -348,6 +348,8 @@ struct request_queue atomic_t refcnt; + unsigned int in_flight; + /* * sg stuff */ @@ -377,6 +379,9 @@ struct request_queue #define blk_fs_request(rq) ((rq)->flags & REQ_CMD) #define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) #define blk_noretry_request(rq) ((rq)->flags & REQ_FAILFAST) +#define blk_rq_started(rq) ((rq)->flags & REQ_STARTED) + +#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) #define blk_pm_suspend_request(rq) ((rq)->flags & REQ_PM_SUSPEND) #define blk_pm_resume_request(rq) ((rq)->flags & REQ_PM_RESUME) |
