Re: REN2 [07/13] Common constants for kmalloc boundaries

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

 



Hi Christoph,

On Thu, Jan 10, 2013 at 4:14 PM, Christoph Lameter <cl@xxxxxxxxx> wrote:
> Standardize the constants that describe the smallest and largest
> object kept in the kmalloc arrays for SLAB and SLUB.
>
> Differentiate between the maximum size for which a slab cache is used
> (KMALLOC_MAX_CACHE_SIZE) and the maximum allocatable size
> (KMALLOC_MAX_SIZE, KMALLOC_MAX_ORDER).
>
> Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>
>
> Index: linux/include/linux/slab.h
> ===================================================================
> --- linux.orig/include/linux/slab.h     2013-01-10 09:42:25.640301677 -0600
> +++ linux/include/linux/slab.h  2013-01-10 09:43:40.857456229 -0600
> @@ -163,7 +163,12 @@ struct kmem_cache {
>  #else /* CONFIG_SLOB */
>
>  /*
> - * The largest kmalloc size supported by the slab allocators is
> + * Kmalloc array related definitions
> + */
> +
> +#ifdef CONFIG_SLAB
> +/*
> + * The largest kmalloc size supported by the SLAB allocators is
>   * 32 megabyte (2^25) or the maximum allocatable page order if that is
>   * less than 32 MB.
>   *
> @@ -173,9 +178,24 @@ struct kmem_cache {
>   */
>  #define KMALLOC_SHIFT_HIGH     ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
>                                 (MAX_ORDER + PAGE_SHIFT - 1) : 25)
> +#define KMALLOC_SHIFT_MAX      KMALLOC_SHIFT_HIGH
> +#define KMALLOC_SHIFT_LOW      5
> +#else
> +/*
> + * SLUB allocates up to order 2 pages directly and otherwise
> + * passes the request to the page allocator.
> + */
> +#define KMALLOC_SHIFT_HIGH     (PAGE_SHIFT + 1)
> +#define KMALLOC_SHIFT_MAX      (MAX_ORDER + PAGE_SHIFT)
> +#define KMALLOC_SHIFT_LOW      3
> +#endif
>

Why do we need to distinguish SLAB from SLUB here?

I mean: why do we need to maintain 32 bytes as the smallest kmalloc cache?

Thanks,

-- 
    Ezequiel

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


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