]> Pileus Git - ~andy/linux/blobdiff - mm/slab_common.c
Merge branch 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penber...
[~andy/linux] / mm / slab_common.c
index eacdffaf71c92317d0145960e87b06ced89c4777..538bade6df7dc2a3f27c9ad5ac5f0efc8a6d08bc 100644 (file)
@@ -373,8 +373,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
 {
        int index;
 
-       if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+       if (size > KMALLOC_MAX_SIZE) {
+               WARN_ON_ONCE(!(flags & __GFP_NOWARN));
                return NULL;
+       }
 
        if (size <= 192) {
                if (!size)
@@ -446,18 +448,18 @@ void __init create_kmalloc_caches(unsigned long flags)
                if (!kmalloc_caches[i]) {
                        kmalloc_caches[i] = create_kmalloc_cache(NULL,
                                                        1 << i, flags);
+               }
 
-                       /*
-                        * Caches that are not of the two-to-the-power-of size.
-                        * These have to be created immediately after the
-                        * earlier power of two caches
-                        */
-                       if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[1] && i == 6)
-                               kmalloc_caches[1] = create_kmalloc_cache(NULL, 96, flags);
+               /*
+                * Caches that are not of the two-to-the-power-of size.
+                * These have to be created immediately after the
+                * earlier power of two caches
+                */
+               if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[1] && i == 6)
+                       kmalloc_caches[1] = create_kmalloc_cache(NULL, 96, flags);
 
-                       if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[2] && i == 7)
-                               kmalloc_caches[2] = create_kmalloc_cache(NULL, 192, flags);
-               }
+               if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[2] && i == 7)
+                       kmalloc_caches[2] = create_kmalloc_cache(NULL, 192, flags);
        }
 
        /* Kmalloc array is now usable */