From: Vivek Goyal <vgoyal@redhat.com>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] cfq-iosched: Get rid of cfqd->unplug_work and use blk_run_queue_async()
Date: Fri, 22 Apr 2011 13:59:00 -0400 [thread overview]
Message-ID: <20110422175900.GD8255@redhat.com> (raw)
Hi Jens,
As hinted by Christoph, will this be a good little cleanup. I have one
concern though. Now it might happen that cfq schedules work and then exits
without cleaning up the scheduled work. AFAIK, that should not create problem
as long as queue is around. If queue is exiting, it should cancel all the
pending work on kblockd. So I am hoping it is not an issue.
I have done basic boot testing and IO scheduler switching.
CFQ needs to kick the queue asynchronously in some situations like upon
expiry of idle timer. CFQ was using its own work structure to queue on
kblockd workqueue to achieve this. Now blk_run_queue_async() does it
by putting delay_work on kblockd workqueue. Use that instead of queuing
your own work.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
block/cfq-iosched.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
Index: linux-2.6/block/cfq-iosched.c
===================================================================
--- linux-2.6.orig/block/cfq-iosched.c 2011-04-21 11:17:01.000000000 -0400
+++ linux-2.6/block/cfq-iosched.c 2011-04-22 13:31:08.411895257 -0400
@@ -262,7 +262,6 @@ struct cfq_data {
* idle window management
*/
struct timer_list idle_slice_timer;
- struct work_struct unplug_work;
struct cfq_queue *active_queue;
struct cfq_io_context *active_cic;
@@ -498,7 +497,7 @@ static inline void cfq_schedule_dispatch
{
if (cfqd->busy_queues) {
cfq_log(cfqd, "schedule dispatch");
- kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work);
+ blk_run_queue_async(cfqd->queue);
}
}
@@ -3728,17 +3727,6 @@ queue_fail:
return 1;
}
-static void cfq_kick_queue(struct work_struct *work)
-{
- struct cfq_data *cfqd =
- container_of(work, struct cfq_data, unplug_work);
- struct request_queue *q = cfqd->queue;
-
- spin_lock_irq(q->queue_lock);
- __blk_run_queue(cfqd->queue);
- spin_unlock_irq(q->queue_lock);
-}
-
/*
* Timer running if the active_queue is currently idling inside its time slice
*/
@@ -3795,10 +3783,9 @@ out_cont:
spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
}
-static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
+static void cfq_shutdown_timer(struct cfq_data *cfqd)
{
del_timer_sync(&cfqd->idle_slice_timer);
- cancel_work_sync(&cfqd->unplug_work);
}
static void cfq_put_async_queues(struct cfq_data *cfqd)
@@ -3826,7 +3813,7 @@ static void cfq_exit_queue(struct elevat
struct cfq_data *cfqd = e->elevator_data;
struct request_queue *q = cfqd->queue;
- cfq_shutdown_timer_wq(cfqd);
+ cfq_shutdown_timer(cfqd);
spin_lock_irq(q->queue_lock);
@@ -3847,7 +3834,7 @@ static void cfq_exit_queue(struct elevat
spin_unlock_irq(q->queue_lock);
- cfq_shutdown_timer_wq(cfqd);
+ cfq_shutdown_timer(cfqd);
spin_lock(&cic_index_lock);
ida_remove(&cic_index_ida, cfqd->cic_index);
@@ -3944,8 +3931,6 @@ static void *cfq_init_queue(struct reque
cfqd->idle_slice_timer.function = cfq_idle_slice_timer;
cfqd->idle_slice_timer.data = (unsigned long) cfqd;
- INIT_WORK(&cfqd->unplug_work, cfq_kick_queue);
-
cfqd->cfq_quantum = cfq_quantum;
cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0];
cfqd->cfq_fifo_expire[1] = cfq_fifo_expire[1];
reply other threads:[~2011-04-22 17:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110422175900.GD8255@redhat.com \
--to=vgoyal@redhat.com \
--cc=hch@infradead.org \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.