aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-04-24 07:42:56 -0400
committerTejun Heo <tj@kernel.org>2013-05-14 13:50:07 -0400
commit695588f9454bdbc7c1a2fbb8a6bfdcfba6183348 (patch)
tree4a9963696a82937133acaa8ea682c88ff3d798af
parentbbb47bdeae756f04b896b55b51f230f3eb21f207 (diff)
block: queue work on power efficient wq
Block layer uses workqueues for multiple purposes. There is no real dependency of scheduling these on the cpu which scheduled them. On a idle system, it is observed that and idle cpu wakes up many times just to service this work. It would be better if we can schedule it on a cpu which the scheduler believes to be the most appropriate one. This patch replaces normal workqueues with power efficient versions. Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--block/blk-core.c3
-rw-r--r--block/blk-ioc.c3
-rw-r--r--block/genhd.c12
3 files changed, 12 insertions, 6 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 33c33bc99ddd..f0deb8bf89e1 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3180,7 +3180,8 @@ int __init blk_dev_init(void)
3180 3180
3181 /* used for unplugging and affects IO latency/throughput - HIGHPRI */ 3181 /* used for unplugging and affects IO latency/throughput - HIGHPRI */
3182 kblockd_workqueue = alloc_workqueue("kblockd", 3182 kblockd_workqueue = alloc_workqueue("kblockd",
3183 WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); 3183 WQ_MEM_RECLAIM | WQ_HIGHPRI |
3184 WQ_POWER_EFFICIENT, 0);
3184 if (!kblockd_workqueue) 3185 if (!kblockd_workqueue)
3185 panic("Failed to create kblockd\n"); 3186 panic("Failed to create kblockd\n");
3186 3187
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 9c4bb8266bc8..4464c823cff2 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -144,7 +144,8 @@ void put_io_context(struct io_context *ioc)
144 if (atomic_long_dec_and_test(&ioc->refcount)) { 144 if (atomic_long_dec_and_test(&ioc->refcount)) {
145 spin_lock_irqsave(&ioc->lock, flags); 145 spin_lock_irqsave(&ioc->lock, flags);
146 if (!hlist_empty(&ioc->icq_list)) 146 if (!hlist_empty(&ioc->icq_list))
147 schedule_work(&ioc->release_work); 147 queue_work(system_power_efficient_wq,
148 &ioc->release_work);
148 else 149 else
149 free_ioc = true; 150 free_ioc = true;
150 spin_unlock_irqrestore(&ioc->lock, flags); 151 spin_unlock_irqrestore(&ioc->lock, flags);
diff --git a/block/genhd.c b/block/genhd.c
index 20625eed5511..e9094b375c05 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1489,9 +1489,11 @@ static void __disk_unblock_events(struct gendisk *disk, bool check_now)
1489 intv = disk_events_poll_jiffies(disk); 1489 intv = disk_events_poll_jiffies(disk);
1490 set_timer_slack(&ev->dwork.timer, intv / 4); 1490 set_timer_slack(&ev->dwork.timer, intv / 4);
1491 if (check_now) 1491 if (check_now)
1492 queue_delayed_work(system_freezable_wq, &ev->dwork, 0); 1492 queue_delayed_work(system_freezable_power_efficient_wq,
1493 &ev->dwork, 0);
1493 else if (intv) 1494 else if (intv)
1494 queue_delayed_work(system_freezable_wq, &ev->dwork, intv); 1495 queue_delayed_work(system_freezable_power_efficient_wq,
1496 &ev->dwork, intv);
1495out_unlock: 1497out_unlock:
1496 spin_unlock_irqrestore(&ev->lock, flags); 1498 spin_unlock_irqrestore(&ev->lock, flags);
1497} 1499}
@@ -1534,7 +1536,8 @@ void disk_flush_events(struct gendisk *disk, unsigned int mask)
1534 spin_lock_irq(&ev->lock); 1536 spin_lock_irq(&ev->lock);
1535 ev->clearing |= mask; 1537 ev->clearing |= mask;
1536 if (!ev->block) 1538 if (!ev->block)
1537 mod_delayed_work(system_freezable_wq, &ev->dwork, 0); 1539 mod_delayed_work(system_freezable_power_efficient_wq,
1540 &ev->dwork, 0);
1538 spin_unlock_irq(&ev->lock); 1541 spin_unlock_irq(&ev->lock);
1539} 1542}
1540 1543
@@ -1627,7 +1630,8 @@ static void disk_check_events(struct disk_events *ev,
1627 1630
1628 intv = disk_events_poll_jiffies(disk); 1631 intv = disk_events_poll_jiffies(disk);
1629 if (!ev->block && intv) 1632 if (!ev->block && intv)
1630 queue_delayed_work(system_freezable_wq, &ev->dwork, intv); 1633 queue_delayed_work(system_freezable_power_efficient_wq,
1634 &ev->dwork, intv);
1631 1635
1632 spin_unlock_irq(&ev->lock); 1636 spin_unlock_irq(&ev->lock);
1633 1637