Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-git1 softlockup while bootup on powerpc

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jens Axboe
Date: Tuesday, February 19, 2008 - 1:36 am

On Tue, Feb 19 2008, KAMEZAWA Hiroyuki wrote:

Why does it keep repeating then? If ->key is NULL, the next lookup index
should be 1UL.

But I think the radix 'scan over entire tree' is a bit fragile. This
patch adds a parallel hlist for ease of properly browsing the members,
does that work for you? It compiles, but I haven't booted it here yet...


It doesn't make a lot of sense, I'm afraid.

 block/blk-ioc.c           |   35 +++++++++++++++--------------------
 block/cfq-iosched.c       |   37 +++++++++++--------------------------
 include/linux/iocontext.h |    2 ++
 3 files changed, 28 insertions(+), 46 deletions(-)

diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 80245dc..73c7002 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -17,17 +17,13 @@ static struct kmem_cache *iocontext_cachep;
 
 static void cfq_dtor(struct io_context *ioc)
 {
-	struct cfq_io_context *cic[1];
-	int r;
+	if (!hlist_empty(&ioc->cic_list)) {
+		struct cfq_io_context *cic;
 
-	/*
-	 * We don't have a specific key to lookup with, so use the gang
-	 * lookup to just retrieve the first item stored. The cfq exit
-	 * function will iterate the full tree, so any member will do.
-	 */
-	r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
-	if (r > 0)
-		cic[0]->dtor(ioc);
+		cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
+								cic_list);
+		cic->dtor(ioc);
+	}
 }
 
 /*
@@ -57,18 +53,16 @@ EXPORT_SYMBOL(put_io_context);
 
 static void cfq_exit(struct io_context *ioc)
 {
-	struct cfq_io_context *cic[1];
-	int r;
-
 	rcu_read_lock();
-	/*
-	 * See comment for cfq_dtor()
-	 */
-	r = radix_tree_gang_lookup(&ioc->radix_root, (void **) cic, 0, 1);
-	rcu_read_unlock();
 
-	if (r > 0)
-		cic[0]->exit(ioc);
+	if (!hlist_empty(&ioc->cic_list)) {
+		struct cfq_io_context *cic;
+
+		cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
+								cic_list);
+		cic->exit(ioc);
+	}
+	rcu_read_unlock();
 }
 
 /* Called by the exitting task */
@@ -105,6 +99,7 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
 		ret->nr_batch_requests = 0; /* because this is 0 */
 		ret->aic = NULL;
 		INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
+		INIT_HLIST_HEAD(&ret->cic_list);
 		ret->ioc_data = NULL;
 	}
 
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ca198e6..62eda3f 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1145,38 +1145,19 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
 /*
  * Call func for each cic attached to this ioc. Returns number of cic's seen.
  */
-#define CIC_GANG_NR	16
 static unsigned int
 call_for_each_cic(struct io_context *ioc,
 		  void (*func)(struct io_context *, struct cfq_io_context *))
 {
-	struct cfq_io_context *cics[CIC_GANG_NR];
-	unsigned long index = 0;
-	unsigned int called = 0;
-	int nr;
+	struct cfq_io_context *cic;
+	struct hlist_node *n;
+	int called = 0;
 
 	rcu_read_lock();
-
-	do {
-		int i;
-
-		/*
-		 * Perhaps there's a better way - this just gang lookups from
-		 * 0 to the end, restarting after each CIC_GANG_NR from the
-		 * last key + 1.
-		 */
-		nr = radix_tree_gang_lookup(&ioc->radix_root, (void **) cics,
-						index, CIC_GANG_NR);
-		if (!nr)
-			break;
-
-		called += nr;
-		index = 1 + (unsigned long) cics[nr - 1]->key;
-
-		for (i = 0; i < nr; i++)
-			func(ioc, cics[i]);
-	} while (nr == CIC_GANG_NR);
-
+	hlist_for_each_entry_rcu(cic, n, &ioc->cic_list, cic_list) {
+		func(ioc, cic);
+		called++;
+	}
 	rcu_read_unlock();
 
 	return called;
@@ -1190,6 +1171,7 @@ static void cic_free_func(struct io_context *ioc, struct cfq_io_context *cic)
 
 	spin_lock_irqsave(&ioc->lock, flags);
 	radix_tree_delete(&ioc->radix_root, cic->dead_key);
+	hlist_del_rcu(&cic->cic_list);
 	spin_unlock_irqrestore(&ioc->lock, flags);
 
 	kmem_cache_free(cfq_ioc_pool, cic);
@@ -1280,6 +1262,7 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
 	if (cic) {
 		cic->last_end_request = jiffies;
 		INIT_LIST_HEAD(&cic->queue_list);
+		INIT_HLIST_NODE(&cic->cic_list);
 		cic->dtor = cfq_free_io_context;
 		cic->exit = cfq_exit_io_context;
 		elv_ioc_count_inc(ioc_count);
@@ -1501,6 +1484,7 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
 		rcu_assign_pointer(ioc->ioc_data, NULL);
 
 	radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd);
+	hlist_del_rcu(&cic->cic_list);
 	spin_unlock_irqrestore(&ioc->lock, flags);
 
 	cfq_cic_free(cic);
@@ -1561,6 +1545,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc,
 		spin_lock_irqsave(&ioc->lock, flags);
 		ret = radix_tree_insert(&ioc->radix_root,
 						(unsigned long) cfqd, cic);
+		hlist_add_head_rcu(&cic->cic_list, &ioc->cic_list);
 		spin_unlock_irqrestore(&ioc->lock, flags);
 
 		radix_tree_preload_end();
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 593b222..1b4ccf2 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -50,6 +50,7 @@ struct cfq_io_context {
 	sector_t seek_mean;
 
 	struct list_head queue_list;
+	struct hlist_node cic_list;
 
 	void (*dtor)(struct io_context *); /* destructor */
 	void (*exit)(struct io_context *); /* called on task exit */
@@ -77,6 +78,7 @@ struct io_context {
 
 	struct as_io_context *aic;
 	struct radix_tree_root radix_root;
+	struct hlist_head cic_list;
 	void *ioc_data;
 };
 

-- 
Jens Axboe

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Linux 2.6.25-rc2, Linus Torvalds, (Fri Feb 15, 2:23 pm)
Re: Linux 2.6.25-rc2, Rafael J. Wysocki, (Fri Feb 15, 7:08 pm)
[BUG] Linux 2.6.25-rc2 - Kernel Ooops while running dbench, Kamalesh Babulal, (Fri Feb 15, 10:44 pm)
[BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-git1 s ..., Kamalesh Babulal, (Fri Feb 15, 11:10 pm)
Re: Linux 2.6.25-rc2, Jan Engelhardt, (Sat Feb 16, 9:52 am)
Linux 2.6.25-rc2 regression: LVM cannot find volume group, Tilman Schmidt, (Sat Feb 16, 12:14 pm)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Sat Feb 16, 2:38 pm)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., Rafael J. Wysocki, (Sun Feb 17, 1:08 pm)
Re: Linux 2.6.25-rc2, Rafael J. Wysocki, (Sun Feb 17, 1:25 pm)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Sun Feb 17, 2:32 pm)
Re: Linux 2.6.25-rc2, Linus Torvalds, (Mon Feb 18, 4:54 pm)
Re: Linux 2.6.25-rc2 regression: LVM cannot find volume group, Alasdair G Kergon, (Mon Feb 18, 6:53 pm)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Mon Feb 18, 11:11 pm)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Mon Feb 18, 11:44 pm)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Mon Feb 18, 11:54 pm)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 12:21 am)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., KAMEZAWA Hiroyuki, (Tue Feb 19, 1:04 am)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., Jens Axboe, (Tue Feb 19, 1:36 am)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., KAMEZAWA Hiroyuki, (Tue Feb 19, 1:47 am)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., KAMEZAWA Hiroyuki, (Tue Feb 19, 2:02 am)
Re: [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-gi ..., KAMEZAWA Hiroyuki, (Tue Feb 19, 2:07 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 3:27 am)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 3:45 am)
Re: Linux 2.6.25-rc2, Mathieu Desnoyers, (Tue Feb 19, 6:02 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 7:00 am)
Re: Linux 2.6.25-rc2, Mathieu Desnoyers, (Tue Feb 19, 7:02 am)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 7:21 am)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 7:38 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 7:55 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 7:57 am)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 8:52 am)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Tue Feb 19, 8:54 am)
Re: Linux 2.6.25-rc2, Linus Torvalds, (Tue Feb 19, 9:20 am)
Re: Linux 2.6.25-rc2, Eric Dumazet, (Tue Feb 19, 9:27 am)
Re: Linux 2.6.25-rc2, Linus Torvalds, (Tue Feb 19, 9:38 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 9:45 am)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Tue Feb 19, 9:48 am)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Tue Feb 19, 11:39 am)
Re: Linux 2.6.25-rc2, Torsten Kaiser, (Tue Feb 19, 12:27 pm)
Re: Linux 2.6.25-rc2, Mathieu Desnoyers, (Tue Feb 19, 1:03 pm)
Re: Linux 2.6.25-rc2, Mathieu Desnoyers, (Tue Feb 19, 1:08 pm)
Re: Linux 2.6.25-rc2, Zhang, Yanmin, (Tue Feb 19, 5:36 pm)
Re: Linux 2.6.25-rc2, Zhang, Yanmin, (Tue Feb 19, 7:08 pm)
Re: Linux 2.6.25-rc2, Zhang, Yanmin, (Tue Feb 19, 11:53 pm)
Re: Linux 2.6.25-rc2, Pekka Enberg, (Wed Feb 20, 12:10 am)
Re: Linux 2.6.25-rc2, Christoph Lameter, (Wed Feb 27, 4:32 pm)
Re: Linux 2.6.25-rc2, Christoph Lameter, (Wed Feb 27, 4:32 pm)
Re: Linux 2.6.25-rc2, Christoph Lameter, (Wed Feb 27, 4:34 pm)
Re: Linux 2.6.25-rc2, Andrew Morton, (Wed Feb 27, 6:57 pm)
Re: Linux 2.6.25-rc2, Christoph Lameter, (Wed Feb 27, 7:43 pm)
[PATCH] Implement slub fastpath in terms of freebase and f ..., Mathieu Desnoyers, (Wed Feb 27, 10:55 pm)
Re: Linux 2.6.25-rc2, Ingo Molnar, (Thu Feb 28, 1:14 am)
Re: Linux 2.6.25-rc2, Jiri Kosina, (Thu Feb 28, 4:13 am)
Re: Linux 2.6.25-rc2, Alan Cox, (Thu Feb 28, 4:15 am)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Christoph Lameter, (Thu Feb 28, 12:08 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Mathieu Desnoyers, (Thu Feb 28, 4:25 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Christoph Lameter, (Thu Feb 28, 5:57 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Mathieu Desnoyers, (Thu Feb 28, 6:56 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Christoph Lameter, (Thu Feb 28, 7:12 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Mathieu Desnoyers, (Thu Feb 28, 8:32 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Christoph Lameter, (Thu Feb 28, 10:11 pm)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Mathieu Desnoyers, (Fri Feb 29, 6:03 am)
[PATCH] Slub Freeoffset check overflow, Mathieu Desnoyers, (Fri Feb 29, 6:28 am)
Re: [PATCH] Implement slub fastpath in terms of freebase a ..., Christoph Lameter, (Fri Feb 29, 12:57 pm)
[PATCH] Slub Freeoffset check overflow (updated), Mathieu Desnoyers, (Mon Mar 3, 11:17 pm)
Re: [PATCH] Slub Freeoffset check overflow (updated), Christoph Lameter, (Tue Mar 4, 12:15 am)