Skip to contentSkip to conversation

use cheaper elv_queue_empty when unplug a device

PATCH In review [email protected] 1 participant 1 message Apr 12, 2005 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 128/198 use cheaper elv_queue_empty when unplug a device

From: Ken Chen <[email protected]>

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().

---

 25-akpm/drivers/block/ll_rw_blk.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/block/ll_rw_blk.c renamed from drivers/block/ll_rw_blk.c~use-cheaper-elv_queue_empty-when-unplug-a-device +2 -1
diff -puN drivers/block/ll_rw_blk.c~use-cheaper-elv_queue_empty-when-unplug-a-device drivers/block/ll_rw_blk.c
@@ -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);

_