• Andrew Morton's avatar
    [PATCH] Correct unplugs on nr_queued · 1dc841ed
    Andrew Morton authored
    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.
    1dc841ed
ll_rw_blk.c 76.2 KB