Commit 66b3dc1f authored by Zheng Yejian's avatar Zheng Yejian Committed by Vlastimil Babka

mm/slub: remove parameter 'flags' in create_kmalloc_caches()

After commit 16a1d968 ("mm/slab: remove mm/slab.c and slab_def.h"),
parameter 'flags' is only passed as 0 in create_kmalloc_caches(), and
then it is only passed to new_kmalloc_cache().

So we can change parameter 'flags' to be a local variable with
initial value 0 in new_kmalloc_cache() and remove parameter 'flags'
in create_kmalloc_caches(). Also make new_kmalloc_cache() static
due to it is only used in mm/slab_common.c.
Signed-off-by: default avatarZheng Yejian <zhengyejian1@huawei.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Reviewed-by: default avatarChengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
parent 98d3b6d9
...@@ -387,7 +387,7 @@ extern const struct kmalloc_info_struct { ...@@ -387,7 +387,7 @@ extern const struct kmalloc_info_struct {
/* Kmalloc array related functions */ /* Kmalloc array related functions */
void setup_kmalloc_cache_index_table(void); void setup_kmalloc_cache_index_table(void);
void create_kmalloc_caches(slab_flags_t); void create_kmalloc_caches(void);
extern u8 kmalloc_size_index[24]; extern u8 kmalloc_size_index[24];
...@@ -422,8 +422,6 @@ gfp_t kmalloc_fix_flags(gfp_t flags); ...@@ -422,8 +422,6 @@ gfp_t kmalloc_fix_flags(gfp_t flags);
int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags); int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags);
void __init kmem_cache_init(void); void __init kmem_cache_init(void);
void __init new_kmalloc_cache(int idx, enum kmalloc_cache_type type,
slab_flags_t flags);
extern void create_boot_cache(struct kmem_cache *, const char *name, extern void create_boot_cache(struct kmem_cache *, const char *name,
unsigned int size, slab_flags_t flags, unsigned int size, slab_flags_t flags,
unsigned int useroffset, unsigned int usersize); unsigned int useroffset, unsigned int usersize);
......
...@@ -853,9 +853,10 @@ static unsigned int __kmalloc_minalign(void) ...@@ -853,9 +853,10 @@ static unsigned int __kmalloc_minalign(void)
return max(minalign, arch_slab_minalign()); return max(minalign, arch_slab_minalign());
} }
void __init static void __init
new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) new_kmalloc_cache(int idx, enum kmalloc_cache_type type)
{ {
slab_flags_t flags = 0;
unsigned int minalign = __kmalloc_minalign(); unsigned int minalign = __kmalloc_minalign();
unsigned int aligned_size = kmalloc_info[idx].size; unsigned int aligned_size = kmalloc_info[idx].size;
int aligned_idx = idx; int aligned_idx = idx;
...@@ -902,7 +903,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) ...@@ -902,7 +903,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
* may already have been created because they were needed to * may already have been created because they were needed to
* enable allocations for slab creation. * enable allocations for slab creation.
*/ */
void __init create_kmalloc_caches(slab_flags_t flags) void __init create_kmalloc_caches(void)
{ {
int i; int i;
enum kmalloc_cache_type type; enum kmalloc_cache_type type;
...@@ -913,7 +914,7 @@ void __init create_kmalloc_caches(slab_flags_t flags) ...@@ -913,7 +914,7 @@ void __init create_kmalloc_caches(slab_flags_t flags)
for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) { for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) {
for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
if (!kmalloc_caches[type][i]) if (!kmalloc_caches[type][i])
new_kmalloc_cache(i, type, flags); new_kmalloc_cache(i, type);
/* /*
* Caches that are not of the two-to-the-power-of size. * Caches that are not of the two-to-the-power-of size.
...@@ -922,10 +923,10 @@ void __init create_kmalloc_caches(slab_flags_t flags) ...@@ -922,10 +923,10 @@ void __init create_kmalloc_caches(slab_flags_t flags)
*/ */
if (KMALLOC_MIN_SIZE <= 32 && i == 6 && if (KMALLOC_MIN_SIZE <= 32 && i == 6 &&
!kmalloc_caches[type][1]) !kmalloc_caches[type][1])
new_kmalloc_cache(1, type, flags); new_kmalloc_cache(1, type);
if (KMALLOC_MIN_SIZE <= 64 && i == 7 && if (KMALLOC_MIN_SIZE <= 64 && i == 7 &&
!kmalloc_caches[type][2]) !kmalloc_caches[type][2])
new_kmalloc_cache(2, type, flags); new_kmalloc_cache(2, type);
} }
} }
#ifdef CONFIG_RANDOM_KMALLOC_CACHES #ifdef CONFIG_RANDOM_KMALLOC_CACHES
......
...@@ -5668,7 +5668,7 @@ void __init kmem_cache_init(void) ...@@ -5668,7 +5668,7 @@ void __init kmem_cache_init(void)
/* Now we can use the kmem_cache to allocate kmalloc slabs */ /* Now we can use the kmem_cache to allocate kmalloc slabs */
setup_kmalloc_cache_index_table(); setup_kmalloc_cache_index_table();
create_kmalloc_caches(0); create_kmalloc_caches();
/* Setup random freelists for each cache */ /* Setup random freelists for each cache */
init_freelist_randomization(); init_freelist_randomization();
......
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