[patch 128/198] use cheaper elv_queue_empty when unplug a device

From: akpm
Date: Tue Apr 12 2005 - 13:57:48 EST



From: Ken Chen <kenneth.w.chen@xxxxxxxxx>

In function __generic_unplug_device(), kernel can use a cheaper function
elv_queue_empty() instead of more expensive elv_next_request to find
whether the queue is empty or not. blk_run_queue can also made conditional
on whether queue's emptiness before calling request_fn().

Signed-off-by: Jens Axboe <axboe@xxxxxxx>
Signed-off-by: Ken Chen <kenneth.w.chen@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

25-akpm/drivers/block/ll_rw_blk.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/block/ll_rw_blk.c~use-cheaper-elv_queue_empty-when-unplug-a-device drivers/block/ll_rw_blk.c
--- 25/drivers/block/ll_rw_blk.c~use-cheaper-elv_queue_empty-when-unplug-a-device 2005-04-12 03:21:34.394908080 -0700
+++ 25-akpm/drivers/block/ll_rw_blk.c 2005-04-12 03:21:34.399907320 -0700
@@ -1589,7 +1589,8 @@ void blk_run_queue(struct request_queue

spin_lock_irqsave(q->queue_lock, flags);
blk_remove_plug(q);
- q->request_fn(q);
+ if (!elv_queue_empty(q))
+ q->request_fn(q);
spin_unlock_irqrestore(q->queue_lock, flags);
}
EXPORT_SYMBOL(blk_run_queue);
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/