aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/slub.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 2b50b97a0fc3..f93adb915c00 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2301,8 +2301,15 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2301 text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", 2301 text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d",
2302 (unsigned int)realsize); 2302 (unsigned int)realsize);
2303 s = create_kmalloc_cache(x, text, realsize, flags); 2303 s = create_kmalloc_cache(x, text, realsize, flags);
2304 kmalloc_caches_dma[index] = s; 2304 down_write(&slub_lock);
2305 return s; 2305 if (!kmalloc_caches_dma[index]) {
2306 kmalloc_caches_dma[index] = s;
2307 up_write(&slub_lock);
2308 return s;
2309 }
2310 up_write(&slub_lock);
2311 kmem_cache_destroy(s);
2312 return kmalloc_caches_dma[index];
2306} 2313}
2307#endif 2314#endif
2308 2315