public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] slab: always follow arch requested alignments
@ 2006-07-22 11:06 Heiko Carstens
  2006-07-22 12:06 ` Pekka Enberg
  2006-07-22 14:50 ` Christoph Lameter
  0 siblings, 2 replies; 46+ messages in thread
From: Heiko Carstens @ 2006-07-22 11:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christoph Lameter, linux-kernel

From: Heiko Carstens <heiko.carstens@de.ibm.com>

In kmem_cache_create(): always check if BYTES_PER_WORD is less than
ARCH_SLAB_MINALIGN and disable debug options that would set the
alignment to BYTES_PER_WORD.
This will make sure that all slab caches will have at least an
ARCH_SLAB_MINALIGN alignment.

In addition make sure that a caller mandated align which is greater
than BYTES_PER_WORD also disables the same debug options.
This makes sure that ARCH_KMALLOC_MINALIGN also has an effect if
CONFIG_DEBUG_SLAB is set.

Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---

 mm/slab.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index 0f20843..1f6fc04 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2103,12 +2103,18 @@ #endif
 		if (ralign > BYTES_PER_WORD)
 			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	}
+	if (BYTES_PER_WORD < ARCH_SLAB_MINALIGN)
+		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
+
 	/* 3) caller mandated alignment: disables debug if necessary */
 	if (ralign < align) {
 		ralign = align;
 		if (ralign > BYTES_PER_WORD)
 			flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
 	}
+	if (align > BYTES_PER_WORD)
+		flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
+
 	/*
 	 * 4) Store it. Note that the debug code below can reduce
 	 *    the alignment to BYTES_PER_WORD.

^ permalink raw reply related	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2006-07-27  5:47 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-22 11:06 [patch] slab: always follow arch requested alignments Heiko Carstens
2006-07-22 12:06 ` Pekka Enberg
2006-07-22 14:50 ` Christoph Lameter
2006-07-22 16:26   ` Heiko Carstens
2006-07-22 19:42     ` Christoph Lameter
2006-07-23  7:35       ` Heiko Carstens
2006-07-23 13:03         ` Christoph Lameter
2006-07-23 16:24           ` Heiko Carstens
2006-07-26  8:49             ` Heiko Carstens
2006-07-26  9:55               ` Pekka J Enberg
2006-07-26  8:50             ` [patch 1/2] slab: always consider caller mandated alignment Heiko Carstens
2006-07-26  8:51             ` [patch 2/2] slab: always consider arch " Heiko Carstens
2006-07-26 10:05               ` Pekka J Enberg
2006-07-26 10:13                 ` Heiko Carstens
2006-07-26 10:37                   ` Pekka J Enberg
2006-07-26 10:52                     ` Heiko Carstens
2006-07-26 11:16                       ` Pekka J Enberg
2006-07-26 11:26                         ` Heiko Carstens
2006-07-26 18:06                         ` Manfred Spraul
2006-07-26 18:19                           ` Christoph Lameter
2006-07-26 18:45                             ` Manfred Spraul
2006-07-26 18:59                               ` Christoph Lameter
2006-07-26 19:28                                 ` Manfred Spraul
2006-07-26 19:31                                   ` Christoph Lameter
2006-07-26 19:37                                     ` Manfred Spraul
2006-07-26 19:47                                       ` Christoph Lameter
2006-07-27  5:33                                         ` Pekka J Enberg
2006-07-27  5:47                                           ` Pekka J Enberg
2006-07-27  4:24                                     ` Pekka J Enberg
2006-07-26 11:22     ` [patch] slab: always follow arch requested alignments Pekka Enberg
2006-07-26 11:29       ` Christoph Lameter
2006-07-26 11:32         ` Pekka J Enberg
2006-07-26 11:41           ` Christoph Lameter
2006-07-26 11:48             ` Pekka J Enberg
2006-07-26 11:49               ` Pekka J Enberg
2006-07-26 11:55                 ` Christoph Lameter
2006-07-26 12:05                   ` Pekka Enberg
2006-07-26 12:20                     ` Christoph Lameter
2006-07-26 12:31                       ` Pekka J Enberg
2006-07-26 15:24                         ` Christoph Lameter
2006-07-26 15:43                           ` Pekka Enberg
2006-07-26 16:25                             ` Christoph Lameter
2006-07-26 18:24                             ` Manfred Spraul
2006-07-26 18:28                               ` Christoph Lameter
2006-07-26 12:35                       ` Pekka J Enberg
2006-07-26 12:36                         ` Pekka J Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox