Skip to contentSkip to conversation

slab: fix slab flags for archs use alignment larger 64-bit

PATCH New Giuseppe CAVALLARO 1 participant 2 messages Feb 12, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

sorry... patch also sent to [email protected]

Quoted 27 lines · Giuseppe CAVALLARO

I think, this fix is necessary for all the architectures want to perform DMA into kmalloc caches and need a guaranteed alignment larger than the alignment of a 64-bit integer.
An example is sh architecture where ARCH_KMALLOC_MINALIGN is L1_CACHE_BYTES.

As side effect, these kind of objects cannot be visible within the /proc/slab_allocators file.

---
 mm/slab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/slab.c +1 -1
index ddc41f3..031d785 100644
@@ -2262,7 +2262,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		ralign = align;
 	}
 	/* disable debug if necessary */
-	if (ralign > __alignof__(unsigned long long))
+	if (ralign > ARCH_KMALLOC_MINALIGN)
 		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	/*
 	 * 4) Store it.
#1 lore raw

PATCH 1/1 slab: fix slab flags for archs use alignment larger 64-bit

I think, this fix is necessary for all the architectures want to perform DMA into kmalloc caches and need a guaranteed alignment larger than the alignment of a 64-bit integer.
An example is sh architecture where ARCH_KMALLOC_MINALIGN is L1_CACHE_BYTES.

As side effect, these kind of objects cannot be visible within the /proc/slab_allocators file.

---
 mm/slab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/slab.c +1 -1
index ddc41f3..031d785 100644
@@ -2262,7 +2262,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 		ralign = align;
 	}
 	/* disable debug if necessary */
-	if (ralign > __alignof__(unsigned long long))
+	if (ralign > ARCH_KMALLOC_MINALIGN)
 		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	/*
 	 * 4) Store it.
Signature · 1 line
1.5.6.6