summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-10-30 15:01:39 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 17:37:17 -0800
commit83521d3eb8dd2dfb04dd78b4733e9766f61bb47e (patch)
treee372f6bef5205c12024512f3b1df5a76df7f0fba
parenta8db2db1e6a8d323d87a67c5391d48fe2b97faf5 (diff)
downloadop-kernel-dev-83521d3eb8dd2dfb04dd78b4733e9766f61bb47e.zip
op-kernel-dev-83521d3eb8dd2dfb04dd78b4733e9766f61bb47e.tar.gz
[PATCH] cfq-iosched: move tasklist walk to elevator.c
We're trying to get rid of as much as possible tasklist walks, or at least moving them to core code. This patch falls into the second category. Instead of walking the tasklist in cfq-iosched move that into elv_unregister. The added benefit is that with this change the as ioscheduler might be might unloadable more easily aswell. The new code uses read_lock instead of read_lock_irq because the tasklist_lock only needs irq disabling for writers. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/block/as-iosched.c2
-rw-r--r--drivers/block/cfq-iosched.c22
-rw-r--r--drivers/block/elevator.c21
3 files changed, 23 insertions, 22 deletions
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
index 5641722..c6744ff 100644
--- a/drivers/block/as-iosched.c
+++ b/drivers/block/as-iosched.c
@@ -1973,8 +1973,8 @@ static int __init as_init(void)
static void __exit as_exit(void)
{
- kmem_cache_destroy(arq_pool);
elv_unregister(&iosched_as);
+ kmem_cache_destroy(arq_pool);
}
module_init(as_init);
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 94690e4..5281f8e 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -2418,28 +2418,8 @@ static int __init cfq_init(void)
static void __exit cfq_exit(void)
{
- struct task_struct *g, *p;
- unsigned long flags;
-
- read_lock_irqsave(&tasklist_lock, flags);
-
- /*
- * iterate each process in the system, removing our io_context
- */
- do_each_thread(g, p) {
- struct io_context *ioc = p->io_context;
-
- if (ioc && ioc->cic) {
- ioc->cic->exit(ioc->cic);
- cfq_free_io_context(ioc->cic);
- ioc->cic = NULL;
- }
- } while_each_thread(g, p);
-
- read_unlock_irqrestore(&tasklist_lock, flags);
-
- cfq_slab_kill();
elv_unregister(&iosched_cfq);
+ cfq_slab_kill();
}
module_init(cfq_init);
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index 55621d5..58e881b 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -642,6 +642,27 @@ EXPORT_SYMBOL_GPL(elv_register);
void elv_unregister(struct elevator_type *e)
{
+ struct task_struct *g, *p;
+
+ /*
+ * Iterate every thread in the process to remove the io contexts.
+ */
+ read_lock(&tasklist_lock);
+ do_each_thread(g, p) {
+ struct io_context *ioc = p->io_context;
+ if (ioc && ioc->cic) {
+ ioc->cic->exit(ioc->cic);
+ ioc->cic->dtor(ioc->cic);
+ ioc->cic = NULL;
+ }
+ if (ioc && ioc->aic) {
+ ioc->aic->exit(ioc->aic);
+ ioc->aic->dtor(ioc->aic);
+ ioc->aic = NULL;
+ }
+ } while_each_thread(g, p);
+ read_unlock(&tasklist_lock);
+
spin_lock_irq(&elv_list_lock);
list_del_init(&e->list);
spin_unlock_irq(&elv_list_lock);
OpenPOWER on IntegriCloud