Index: linux-2.6.16-rc4-mm2/mm/slab.c =================================================================== --- linux-2.6.16-rc4-mm2.orig/mm/slab.c 2006-02-28 18:56:36.000000000 -0800 +++ linux-2.6.16-rc4-mm2/mm/slab.c 2006-02-28 19:15:18.000000000 -0800 @@ -3035,17 +3035,24 @@ free_done: memmove(ac->entry, &(ac->entry[batchcount]), sizeof(void *)*ac->avail); } -/* +/** + * kmem_cache_free - Deallocate an object + * @cachep: The cache the allocation was from. + * @objp: The previously allocated object. + * + * Free an object which was previously allocated from this + * cache. * 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 inline void __cache_free(struct kmem_cache *cachep, void *objp) +void kmem_cache_free(struct kmem_cache *cachep, void *objp) { - struct array_cache *ac = cpu_cache_get(cachep); + unsigned long flags; + struct array_cache *ac; - check_irq_off(); objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0)); + local_irq_save(flags); /* Make sure we are not freeing a object from another * node to the array cache on this cpu. */ @@ -3079,16 +3086,19 @@ static inline void __cache_free(struct k } } #endif - if (likely(ac->avail < ac->limit)) { + ac = cpu_cache_get(cachep); + if (likely(ac->avail < ac->limit)) STATS_INC_FREEHIT(cachep); - ac->entry[ac->avail++] = objp; - return; - } else { + else { STATS_INC_FREEMISS(cachep); cache_flusharray(cachep, ac); - ac->entry[ac->avail++] = objp; } + ac->entry[ac->avail++] = objp; + local_irq_restore(flags); } +EXPORT_SYMBOL(kmem_cache_free); + +/* /** * kmem_cache_alloc - Allocate an object @@ -3299,24 +3309,6 @@ EXPORT_SYMBOL(__alloc_percpu); #endif /** - * kmem_cache_free - Deallocate an object - * @cachep: The cache the allocation was from. - * @objp: The previously allocated object. - * - * Free an object which was previously allocated from this - * cache. - */ -void kmem_cache_free(struct kmem_cache *cachep, void *objp) -{ - unsigned long flags; - - local_irq_save(flags); - __cache_free(cachep, objp); - local_irq_restore(flags); -} -EXPORT_SYMBOL(kmem_cache_free); - -/** * kfree - free previously allocated memory * @objp: pointer returned by kmalloc. *