slab, slub, slob: Unify alignment definition
Every slab has its on alignment definition in include/linux/sl?b_def.h. Extract those and define a common set in include/linux/slab.h. SLOB: As notes sometimes we need double word alignment on 32 bit. This gives all structures allocated by SLOB a unsigned long long alignment like the others do. SLAB: If ARCH_SLAB_MINALIGN is not set SLAB would set ARCH_SLAB_MINALIGN to zero meaning no alignment at all. Give it the default unsigned long long alignment. Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:

committed by
Pekka Enberg

parent
bd50cfa891
commit
3192b920bf
@@ -17,32 +17,6 @@
|
||||
|
||||
#include <trace/events/kmem.h>
|
||||
|
||||
/*
|
||||
* Enforce a minimum alignment for the kmalloc caches.
|
||||
* Usually, the kmalloc caches are cache_line_size() aligned, except when
|
||||
* DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
|
||||
* Some archs want to perform DMA into kmalloc caches and need a guaranteed
|
||||
* alignment larger than the alignment of a 64-bit integer.
|
||||
* ARCH_KMALLOC_MINALIGN allows that.
|
||||
* Note that increasing this value may disable some debug features.
|
||||
*/
|
||||
#ifdef ARCH_DMA_MINALIGN
|
||||
#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
|
||||
#else
|
||||
#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
|
||||
#endif
|
||||
|
||||
#ifndef ARCH_SLAB_MINALIGN
|
||||
/*
|
||||
* Enforce a minimum alignment for all caches.
|
||||
* Intended for archs that get misalignment faults even for BYTES_PER_WORD
|
||||
* aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
|
||||
* If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
|
||||
* some debug features.
|
||||
*/
|
||||
#define ARCH_SLAB_MINALIGN 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct kmem_cache
|
||||
*
|
||||
|
Reference in New Issue
Block a user