]> Git Repo - J-linux.git/blobdiff - mm/slab_common.c
Merge branches 'slab/for-5.19/stackdepot' and 'slab/for-5.19/refactor' into slab...
[J-linux.git] / mm / slab_common.c
index 73943479a2b767702514011e82c0d3623453253c..c4d63f2c78b8afec55c1ed98fa34a672f380ef5b 100644 (file)
@@ -854,6 +854,8 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
                        return;
                }
                flags |= SLAB_ACCOUNT;
+       } else if (IS_ENABLED(CONFIG_ZONE_DMA) && (type == KMALLOC_DMA)) {
+               flags |= SLAB_CACHE_DMA;
        }
 
        kmalloc_caches[type][idx] = create_kmalloc_cache(
@@ -882,7 +884,7 @@ void __init create_kmalloc_caches(slab_flags_t flags)
        /*
         * Including KMALLOC_CGROUP if CONFIG_MEMCG_KMEM defined
         */
-       for (type = KMALLOC_NORMAL; type <= KMALLOC_RECLAIM; type++) {
+       for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) {
                for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
                        if (!kmalloc_caches[type][i])
                                new_kmalloc_cache(i, type, flags);
@@ -903,20 +905,6 @@ void __init create_kmalloc_caches(slab_flags_t flags)
 
        /* Kmalloc array is now usable */
        slab_state = UP;
-
-#ifdef CONFIG_ZONE_DMA
-       for (i = 0; i <= KMALLOC_SHIFT_HIGH; i++) {
-               struct kmem_cache *s = kmalloc_caches[KMALLOC_NORMAL][i];
-
-               if (s) {
-                       kmalloc_caches[KMALLOC_DMA][i] = create_kmalloc_cache(
-                               kmalloc_info[i].name[KMALLOC_DMA],
-                               kmalloc_info[i].size,
-                               SLAB_CACHE_DMA | flags, 0,
-                               kmalloc_info[i].size);
-               }
-       }
-#endif
 }
 #endif /* !CONFIG_SLOB */
 
This page took 0.028361 seconds and 4 git commands to generate.