--- mm/slub.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Index: slub/mm/slub.c =================================================================== --- slub.orig/mm/slub.c 2007-06-08 11:12:40.000000000 -0700 +++ slub/mm/slub.c 2007-06-08 11:26:04.000000000 -0700 @@ -2738,7 +2738,15 @@ int kmem_cache_defrag(int percent, int n unsigned long pages = 0; void *scratch; - down_read(&slub_lock); + /* + * kmem_cache_defrag may be called from the reclaim path which may be + * called for any page allocator alloc. So there is the danger that we + * get called in a situation where slub already acquired the slub_lock + * for other purposes. + */ + if (!down_read_trylock(&slub_lock)) + return 0; + list_for_each_entry(s, &slab_caches, list) { /*