提交 873623df 编写于 作者: I Ingo Molnar 提交者: Linus Torvalds

[PATCH] lockdep: undo mm/slab.c annotation

undo existing mm/slab.c lock-validator annotations, in preparation
of a new, less intrusive annotation patch.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 0e2ffbf6
...@@ -1021,8 +1021,7 @@ static void drain_alien_cache(struct kmem_cache *cachep, ...@@ -1021,8 +1021,7 @@ static void drain_alien_cache(struct kmem_cache *cachep,
} }
} }
static inline int cache_free_alien(struct kmem_cache *cachep, void *objp, static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
int nesting)
{ {
struct slab *slabp = virt_to_slab(objp); struct slab *slabp = virt_to_slab(objp);
int nodeid = slabp->nodeid; int nodeid = slabp->nodeid;
...@@ -1040,7 +1039,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp, ...@@ -1040,7 +1039,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp,
STATS_INC_NODEFREES(cachep); STATS_INC_NODEFREES(cachep);
if (l3->alien && l3->alien[nodeid]) { if (l3->alien && l3->alien[nodeid]) {
alien = l3->alien[nodeid]; alien = l3->alien[nodeid];
spin_lock_nested(&alien->lock, nesting); spin_lock(&alien->lock);
if (unlikely(alien->avail == alien->limit)) { if (unlikely(alien->avail == alien->limit)) {
STATS_INC_ACOVERFLOW(cachep); STATS_INC_ACOVERFLOW(cachep);
__drain_alien_cache(cachep, alien, nodeid); __drain_alien_cache(cachep, alien, nodeid);
...@@ -1069,8 +1068,7 @@ static inline void free_alien_cache(struct array_cache **ac_ptr) ...@@ -1069,8 +1068,7 @@ static inline void free_alien_cache(struct array_cache **ac_ptr)
{ {
} }
static inline int cache_free_alien(struct kmem_cache *cachep, void *objp, static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
int nesting)
{ {
return 0; return 0;
} }
...@@ -1760,8 +1758,6 @@ static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp) ...@@ -1760,8 +1758,6 @@ static void slab_destroy_objs(struct kmem_cache *cachep, struct slab *slabp)
} }
#endif #endif
static void __cache_free(struct kmem_cache *cachep, void *objp, int nesting);
/** /**
* slab_destroy - destroy and release all objects in a slab * slab_destroy - destroy and release all objects in a slab
* @cachep: cache pointer being destroyed * @cachep: cache pointer being destroyed
...@@ -1785,17 +1781,8 @@ static void slab_destroy(struct kmem_cache *cachep, struct slab *slabp) ...@@ -1785,17 +1781,8 @@ static void slab_destroy(struct kmem_cache *cachep, struct slab *slabp)
call_rcu(&slab_rcu->head, kmem_rcu_free); call_rcu(&slab_rcu->head, kmem_rcu_free);
} else { } else {
kmem_freepages(cachep, addr); kmem_freepages(cachep, addr);
if (OFF_SLAB(cachep)) { if (OFF_SLAB(cachep))
unsigned long flags; kmem_cache_free(cachep->slabp_cache, slabp);
/*
* 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);
}
} }
} }
...@@ -3135,7 +3122,7 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac) ...@@ -3135,7 +3122,7 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac)
#endif #endif
check_irq_off(); check_irq_off();
l3 = cachep->nodelists[node]; l3 = cachep->nodelists[node];
spin_lock_nested(&l3->list_lock, SINGLE_DEPTH_NESTING); spin_lock(&l3->list_lock);
if (l3->shared) { if (l3->shared) {
struct array_cache *shared_array = l3->shared; struct array_cache *shared_array = l3->shared;
int max = shared_array->limit - shared_array->avail; int max = shared_array->limit - shared_array->avail;
...@@ -3178,14 +3165,14 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac) ...@@ -3178,14 +3165,14 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac)
* Release an obj back to its cache. If the obj has a constructed state, it must * 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. * 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); struct array_cache *ac = cpu_cache_get(cachep);
check_irq_off(); check_irq_off();
objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0)); objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
if (cache_free_alien(cachep, objp, nesting)) if (cache_free_alien(cachep, objp))
return; return;
if (likely(ac->avail < ac->limit)) { if (likely(ac->avail < ac->limit)) {
...@@ -3424,7 +3411,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) ...@@ -3424,7 +3411,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
BUG_ON(virt_to_cache(objp) != cachep); BUG_ON(virt_to_cache(objp) != cachep);
local_irq_save(flags); local_irq_save(flags);
__cache_free(cachep, objp, 0); __cache_free(cachep, objp);
local_irq_restore(flags); local_irq_restore(flags);
} }
EXPORT_SYMBOL(kmem_cache_free); EXPORT_SYMBOL(kmem_cache_free);
...@@ -3449,7 +3436,7 @@ void kfree(const void *objp) ...@@ -3449,7 +3436,7 @@ void kfree(const void *objp)
kfree_debugcheck(objp); kfree_debugcheck(objp);
c = virt_to_cache(objp); c = virt_to_cache(objp);
debug_check_no_locks_freed(objp, obj_size(c)); debug_check_no_locks_freed(objp, obj_size(c));
__cache_free(c, (void *)objp, 0); __cache_free(c, (void *)objp);
local_irq_restore(flags); local_irq_restore(flags);
} }
EXPORT_SYMBOL(kfree); EXPORT_SYMBOL(kfree);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册