Re: [PATCH] mm/slub: create kmalloc 96 and 192 caches regardless cache size order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 20 Apr 2024, Hyunmin Lee wrote:

> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 3179a6aeffc5..c3271b17eb76 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -919,19 +919,12 @@ void __init create_kmalloc_caches(void)
>  		for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
>  			if (!kmalloc_caches[type][i])
>  				new_kmalloc_cache(i, type);
> -
> -			/*
> -			 * 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 && i == 6 &&
> -					!kmalloc_caches[type][1])
> -				new_kmalloc_cache(1, type);
> -			if (KMALLOC_MIN_SIZE <= 64 && i == 7 &&
> -					!kmalloc_caches[type][2])
> -				new_kmalloc_cache(2, type);
>  		}
> +
> +		if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[type][1])
> +			new_kmalloc_cache(1, type);
> +		if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[type][2])
> +			new_kmalloc_cache(2, type);
>  	}
>  #ifdef CONFIG_RANDOM_KMALLOC_CACHES
>  	random_kmalloc_seed = get_random_u64();

No objection to this, but it would be nice to continue to have a comment 
about why these slab caches are special.

Another thought: can we move the check for NULL kmalloc_caches to 
new_kmalloc_cache() instead of handling it in the caller?





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux