Re: [patch] slab: always follow arch requested alignments

From: Pekka J Enberg
Date: Wed Jul 26 2006 - 05:58:33 EST


Hi Heiko,

On Wed, 26 Jul 2006, Heiko Carstens wrote:
> Since I didn't get an ACK or NACK, I split this patch into two very small
> ones and repost them. Hopefully with a better description than the first
> time.

I don't see ARCH_SLAB_MINALIGN defined for s390, what's up with that? I
agree that we should always respect ARCH_SLAB_MINALIGN no matter what.
Does the included patch fix that for you?

Pekka

[PATCH] slab: respect mandated minimum architecture alignment

The slab debugging code for SLAB_RED_ZONE and SLAB_STORE_USER require
BYTES_PER_WORD alignment for the caches. However, for some architectures,
the mandated minimum alignment might be bigger than that, so disable
debugging for those cases instead of crashing the machine.

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---

diff --git a/mm/slab.c b/mm/slab.c
index 0f20843..0346311 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2123,6 +2123,13 @@ #endif
#if DEBUG
cachep->obj_size = size;

+ /*
+ * Debugging requires BYTES_PER_WORD alignment but we must always
+ * respect ARCH_SLAB_MINALIGN so disable debugging if necessary.
+ */
+ if (ARCH_SLAB_MINALIGN > BYTES_PER_WORD)
+ flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
+
if (flags & SLAB_RED_ZONE) {
/* redzoning only works with word aligned caches */
align = BYTES_PER_WORD;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/