diff options
author | Hyunmin Lee <[email protected]> | 2024-04-24 23:04:22 +0900 |
---|---|---|
committer | Vlastimil Babka <[email protected]> | 2024-05-02 16:09:40 +0200 |
commit | 7338999ca3468404f547b1540211114cbdb26d06 (patch) | |
tree | 60e5a85a517f04d877b9d08925f40bd7dda39863 | |
parent | 306c4ac9896b07b8872293eb224058ff83f81fac (diff) |
mm/slub: remove the check for NULL kmalloc_caches
If the same size kmalloc cache already exists, it should not be created
again. So there is the check for NULL kmalloc_caches before calling the
kmalloc creation function. However, new_kmalloc_cache() itself checks NULL
kmalloc_cahces before cache creation. Therefore, the NULL check is not
necessary in this function.
Signed-off-by: Hyunmin Lee <[email protected]>
Co-developed-by: Jeungwoo Yoo <[email protected]>
Signed-off-by: Jeungwoo Yoo <[email protected]>
Co-developed-by: Sangyun Kim <[email protected]>
Signed-off-by: Sangyun Kim <[email protected]>
Cc: Hyeonggon Yoo <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Reviewed-by: Christoph Lameter <[email protected]>
Acked-by: David Rientjes <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>
-rw-r--r-- | mm/slab_common.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index 7cfdcc8cbf5f..c37f8c41ffb0 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -917,16 +917,14 @@ void __init create_kmalloc_caches(void) */ for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) { /* Caches that are NOT of the two-to-the-power-of size. */ - if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[type][1]) + if (KMALLOC_MIN_SIZE <= 32) new_kmalloc_cache(1, type); - if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[type][2]) + if (KMALLOC_MIN_SIZE <= 64) new_kmalloc_cache(2, type); /* Caches that are of the two-to-the-power-of size. */ - for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { - if (!kmalloc_caches[type][i]) - new_kmalloc_cache(i, type); - } + for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) + new_kmalloc_cache(i, type); } #ifdef CONFIG_RANDOM_KMALLOC_CACHES random_kmalloc_seed = get_random_u64(); |