public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: sekharan@us.ibm.com, torvalds@osdl.org,
	linux-kernel@vger.kernel.org, nagar@watson.ibm.com,
	balbir@in.ibm.com, arjan@infradead.org
Subject: [patch] lockdep: undo mm/slab.c annotation
Date: Thu, 13 Jul 2006 14:44:38 +0200	[thread overview]
Message-ID: <20060713124438.GA18936@elte.hu> (raw)
In-Reply-To: <20060713004445.cf7d1d96.akpm@osdl.org>

Subject: lockdep: undo mm/slab.c annotation
From: Ingo Molnar <mingo@elte.hu>

undo existing mm/slab.c lock-validator annotations, in preparation
of a new, less intrusive annotation patch.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 mm/slab.c |   33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

Index: linux/mm/slab.c
===================================================================
--- linux.orig/mm/slab.c
+++ linux/mm/slab.c
@@ -1021,8 +1021,7 @@ static void drain_alien_cache(struct kme
 	}
 }
 
-static inline int cache_free_alien(struct kmem_cache *cachep, void *objp,
-				   int nesting)
+static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
 {
 	struct slab *slabp = virt_to_slab(objp);
 	int nodeid = slabp->nodeid;
@@ -1040,7 +1039,7 @@ static inline int cache_free_alien(struc
 	STATS_INC_NODEFREES(cachep);
 	if (l3->alien && l3->alien[nodeid]) {
 		alien = l3->alien[nodeid];
-		spin_lock_nested(&alien->lock, nesting);
+		spin_lock(&alien->lock);
 		if (unlikely(alien->avail == alien->limit)) {
 			STATS_INC_ACOVERFLOW(cachep);
 			__drain_alien_cache(cachep, alien, nodeid);
@@ -1069,8 +1068,7 @@ static inline void free_alien_cache(stru
 {
 }
 
-static inline int cache_free_alien(struct kmem_cache *cachep, void *objp,
-				   int nesting)
+static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
 {
 	return 0;
 }
@@ -1760,8 +1758,6 @@ static void slab_destroy_objs(struct kme
 }
 #endif
 
-static void __cache_free(struct kmem_cache *cachep, void *objp, int nesting);
-
 /**
  * slab_destroy - destroy and release all objects in a slab
  * @cachep: cache pointer being destroyed
@@ -1785,17 +1781,8 @@ static void slab_destroy(struct kmem_cac
 		call_rcu(&slab_rcu->head, kmem_rcu_free);
 	} else {
 		kmem_freepages(cachep, addr);
-		if (OFF_SLAB(cachep)) {
-			unsigned long flags;
-
-			/*
-		 	 * lockdep: we may nest inside an already held
-			 * ac->lock, so pass in a nesting flag:
-			 */
-			local_irq_save(flags);
-			__cache_free(cachep->slabp_cache, slabp, 1);
-			local_irq_restore(flags);
-		}
+		if (OFF_SLAB(cachep))
+			kmem_cache_free(cachep->slabp_cache, slabp);
 	}
 }
 
@@ -3126,7 +3113,7 @@ static void cache_flusharray(struct kmem
 #endif
 	check_irq_off();
 	l3 = cachep->nodelists[node];
-	spin_lock_nested(&l3->list_lock, SINGLE_DEPTH_NESTING);
+	spin_lock(&l3->list_lock);
 	if (l3->shared) {
 		struct array_cache *shared_array = l3->shared;
 		int max = shared_array->limit - shared_array->avail;
@@ -3169,14 +3156,14 @@ free_done:
  * Release an obj back to its cache. If the obj has a constructed state, it must
  * be in this state _before_ it is released.  Called with disabled ints.
  */
-static void __cache_free(struct kmem_cache *cachep, void *objp, int nesting)
+static inline void __cache_free(struct kmem_cache *cachep, void *objp)
 {
 	struct array_cache *ac = cpu_cache_get(cachep);
 
 	check_irq_off();
 	objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
 
-	if (cache_free_alien(cachep, objp, nesting))
+	if (cache_free_alien(cachep, objp))
 		return;
 
 	if (likely(ac->avail < ac->limit)) {
@@ -3415,7 +3402,7 @@ void kmem_cache_free(struct kmem_cache *
 	BUG_ON(virt_to_cache(objp) != cachep);
 
 	local_irq_save(flags);
-	__cache_free(cachep, objp, 0);
+	__cache_free(cachep, objp);
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL(kmem_cache_free);
@@ -3440,7 +3427,7 @@ void kfree(const void *objp)
 	kfree_debugcheck(objp);
 	c = virt_to_cache(objp);
 	debug_check_no_locks_freed(objp, obj_size(c));
-	__cache_free(c, (void *)objp, 0);
+	__cache_free(c, (void *)objp);
 	local_irq_restore(flags);
 }
 EXPORT_SYMBOL(kfree);

  parent reply	other threads:[~2006-07-13 12:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-13  3:59 Random panics seen in 2.6.18-rc1 Chandra Seetharaman
2006-07-13  7:12 ` Ingo Molnar
2006-07-13  7:28   ` Andrew Morton
2006-07-13  7:26     ` Ingo Molnar
2006-07-13  7:44       ` Andrew Morton
2006-07-13  7:46         ` Ingo Molnar
2006-07-13  8:49           ` Ingo Molnar
2006-07-13  8:42         ` Ingo Molnar
2006-07-13  8:46           ` [patch] lockdep: more annotations for mm/slab.c Ingo Molnar
2006-07-13  9:08             ` Andrew Morton
2006-07-13  9:18               ` Ingo Molnar
2006-07-13 10:44                 ` Arjan van de Ven
2006-07-13 10:58                   ` Arjan van de Ven
2006-07-13 12:44         ` Ingo Molnar [this message]
2006-07-13 12:46         ` [patch] lockdep: annotate mm/slab.c Ingo Molnar
2006-07-13 15:45           ` Pekka Enberg
2006-07-13 19:55             ` Ingo Molnar
2006-07-13 15:58           ` Pekka Enberg
2006-07-13 18:56             ` Linus Torvalds
2006-07-13 19:21               ` Arjan van de Ven
2006-07-13 22:27                 ` Christoph Lameter
2006-07-13 23:08                   ` Alok kataria
2006-07-13 22:51                 ` Christoph Lameter
2006-07-13 23:16                   ` Andrew Morton
2006-07-14  2:29                     ` Christoph Lameter
2006-07-14  2:46                       ` Christoph Lameter
2006-07-14  3:02                         ` Andrew Morton
2006-07-14  3:35                           ` Christoph Lameter
2006-07-14  3:45                             ` Christoph Lameter
2006-07-14 16:48                               ` Alok kataria
2006-07-14  2:54                       ` Andrew Morton
2006-07-14  2:59                         ` Christoph Lameter
2006-07-13 19:32             ` Ingo Molnar
2006-07-13 18:50           ` Linus Torvalds
2006-07-13 19:06             ` Arjan van de Ven
2006-07-13 19:21               ` Linus Torvalds
2006-07-13 19:26                 ` Arjan van de Ven
2006-07-13 19:17             ` Ingo Molnar
2006-07-13 19:19               ` Ingo Molnar
2006-07-13 21:30             ` Andrew Morton
2006-07-13 13:51   ` Random panics seen in 2.6.18-rc1 Chandra Seetharaman
2006-07-13 16:05     ` Chandra Seetharaman

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=20060713124438.GA18936@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=balbir@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nagar@watson.ibm.com \
    --cc=sekharan@us.ibm.com \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox