Commit 919a670d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kmem_cache_destroy(): use slab_error()

Use slab_error for printing the error message from kmem_cache_destroy
parent 244f3626
...@@ -475,8 +475,6 @@ static void cache_estimate (unsigned long gfporder, size_t size, ...@@ -475,8 +475,6 @@ static void cache_estimate (unsigned long gfporder, size_t size,
*left_over = wastage; *left_over = wastage;
} }
#if DEBUG
#define slab_error(cachep, msg) __slab_error(__FUNCTION__, cachep, msg) #define slab_error(cachep, msg) __slab_error(__FUNCTION__, cachep, msg)
static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg) static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg)
...@@ -486,8 +484,6 @@ static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg) ...@@ -486,8 +484,6 @@ static void __slab_error(const char *function, kmem_cache_t *cachep, char *msg)
dump_stack(); dump_stack();
} }
#endif
/* /*
* Start the reap timer running on the target CPU. We run at around 1 to 2Hz. * Start the reap timer running on the target CPU. We run at around 1 to 2Hz.
* Add the CPU number into the expiry time to minimize the possibility of the * Add the CPU number into the expiry time to minimize the possibility of the
...@@ -1307,6 +1303,8 @@ int kmem_cache_shrink(kmem_cache_t *cachep) ...@@ -1307,6 +1303,8 @@ int kmem_cache_shrink(kmem_cache_t *cachep)
*/ */
int kmem_cache_destroy (kmem_cache_t * cachep) int kmem_cache_destroy (kmem_cache_t * cachep)
{ {
int i;
if (!cachep || in_interrupt()) if (!cachep || in_interrupt())
BUG(); BUG();
...@@ -1319,21 +1317,19 @@ int kmem_cache_destroy (kmem_cache_t * cachep) ...@@ -1319,21 +1317,19 @@ int kmem_cache_destroy (kmem_cache_t * cachep)
up(&cache_chain_sem); up(&cache_chain_sem);
if (__cache_shrink(cachep)) { if (__cache_shrink(cachep)) {
printk(KERN_ERR "kmem_cache_destroy: Can't free all objects %p\n", slab_error(cachep, "Can't free all objects");
cachep);
down(&cache_chain_sem); down(&cache_chain_sem);
list_add(&cachep->next,&cache_chain); list_add(&cachep->next,&cache_chain);
up(&cache_chain_sem); up(&cache_chain_sem);
return 1; return 1;
} }
{
int i; for (i = 0; i < NR_CPUS; i++)
for (i = 0; i < NR_CPUS; i++) kfree(cachep->array[i]);
kfree(cachep->array[i]);
/* NUMA: free the list3 structures */ /* NUMA: free the list3 structures */
kfree(cachep->lists.shared); kfree(cachep->lists.shared);
cachep->lists.shared = NULL; cachep->lists.shared = NULL;
}
kmem_cache_free(&cache_cache, cachep); kmem_cache_free(&cache_cache, cachep);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment