[PATCH v4 01/15] mm/slab: Decouple ARCH_KMALLOC_MINALIGN from ARCH_DMA_MINALIGN

Catalin Marinas catalin.marinas at arm.com
Fri May 19 08:49:04 PDT 2023


On Thu, May 18, 2023 at 06:33:49PM +0100, Catalin Marinas wrote:
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 6b3e155b70bf..3f76e7c53ada 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -235,14 +235,24 @@ void kmem_dump_obj(void *object);
>   * alignment larger than the alignment of a 64-bit integer.
>   * Setting ARCH_DMA_MINALIGN in arch headers allows that.
>   */
> -#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
> +#ifdef ARCH_DMA_MINALIGN
> +#define ARCH_HAS_DMA_MINALIGN
> +#if ARCH_DMA_MINALIGN > 8 && !defined(ARCH_KMALLOC_MINALIGN)
>  #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
> -#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
> -#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
> +#endif
>  #else
> +#define ARCH_DMA_MINALIGN __alignof__(unsigned long long)
> +#endif
> +
> +#ifndef ARCH_KMALLOC_MINALIGN
>  #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
>  #endif
>  
> +#if ARCH_KMALLOC_MINALIGN > 8
> +#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
> +#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
> +#endif

And another fixup here (reported by the test robot; I pushed the fixups
to the git branch):

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 3f76e7c53ada..50dcf9cfbf62 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -246,9 +246,7 @@ void kmem_dump_obj(void *object);

 #ifndef ARCH_KMALLOC_MINALIGN
 #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
-#endif
-
-#if ARCH_KMALLOC_MINALIGN > 8
+#elif ARCH_KMALLOC_MINALIGN > 8
 #define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
 #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
 #endif

-- 
Catalin



More information about the linux-arm-kernel mailing list