From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: [patch] slab: always follow arch requested alignments
Date: Sat, 22 Jul 2006 18:26:07 +0200 [thread overview]
Message-ID: <20060722162607.GA10550@osiris.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0607220748160.13737@schroedinger.engr.sgi.com>
On Sat, Jul 22, 2006 at 07:50:00AM -0700, Christoph Lameter wrote:
> On Sat, 22 Jul 2006, Heiko Carstens wrote:
>
> > 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.
>
> Why disable debug options?
Because if they are still enabled we would end up with an BYTES_PER_WORD
alignment (which is bad, see below).
> > This will make sure that all slab caches will have at least an
> > ARCH_SLAB_MINALIGN alignment.
>
> You can specify alignment at cache creation. Why do we need all slabs to
> be aligned?
Uhm, that's the meaning of ARCH_SLAB_MINALIGN, isn't it?
from mm/slab.c :
#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
> > 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.
>
> Is there a particular problem you are trying to address?
Sorry, I should have mentioned it: on s390 (32 bit) we set
#define ARCH_KMALLOC_MINALIGN 8.
This is needed since our common I/O layer allocates data structures that need
to have an eight byte alignment. Now, if I turn on DEBUG_SLAB, nothing works
anymore, simply because the slab cache code ignores ARCH_KMALLOC_MINALIGN and
uses an BYTES_PER_WORD alignment instead, which it shouldn't:
also from mm/slab.c :
#ifndef ARCH_KMALLOC_MINALIGN
/*
* 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 BYTES_PER_WORD. ARCH_KMALLOC_MINALIGN allows that.
* Note that this flag disables some debug features.
*/
#define ARCH_KMALLOC_MINALIGN 0
#endif
Since that didn't work I thought why not set ARCH_SLAB_MINALIGN to 8, since
that would (according to the description) guarantee that _all_ caches would
have an 8 byte alignment. But that didn't work too.
So the result is this patch, which makes DEBUG_SLAB work on s390. And actually
guarantees what the above descriptions imply (unless the patch is broken).
next prev parent reply other threads:[~2006-07-22 16:28 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060722162607.GA10550@osiris.ibm.com \
--to=heiko.carstens@de.ibm.com \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox