mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: akpm@osdl.org, heiko.carstens@de.ibm.com,
	manfred@colorfullife.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] slab: respect architecture and caller mandated alignment
Date: Thu, 27 Jul 2006 19:25:56 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0607271909580.15840@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0607271514310.2172@sbz-30.cs.Helsinki.FI>

On Thu, 27 Jul 2006, Pekka J Enberg wrote:

> As explained by Heiko, on s390 (32-bit) ARCH_KMALLOC_MINALIGN is set to eight
> because their common I/O layer allocates data structures that need to have an
> eight byte alignment. This does not work when CONFIG_SLAB_DEBUG is enabled
> because kmem_cache_create will override alignment to BYTES_PER_WORD which is
> four.
> 
> So change kmem_cache_create to ensure cache alignment is always at minimum
> what the architecture or caller mandates even if slab debugging is enabled.

Note that this will disable SLAB_RED_ZONE and SLAB_STORE_USER 
for the following SLAB_DEBUG cases:

1. For all slabs if an arch sets ARCH_SLAB_MINALIGN > BYTES_PER_WORD

by:

      /* 2) arch mandated alignment: disables debug if necessary */
        if (ralign < ARCH_SLAB_MINALIGN) {
                ralign = ARCH_SLAB_MINALIGN;
                if (ralign > BYTES_PER_WORD)
                        flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
        }

ralign = BYTES_PER_WORD per your change for slab debug.
ARCH_SLAB_MINALIGN > BYTES_PER_WORD -> SLAB_RED_ZONE and SLAB_STORE_USER 
off.

2. For all general (kmalloc) slabs if an arch sets
   ARCH_KMALLOC_MINALIGN > BYTES_PER_WORD

by:

     /* 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);
        }

ralign = BYTES_PER_WORD by your change.
align = ARCH_KMALLOC_MINALIGN (passed by kmem_cache_init)
Therefore SLAB_RED_ZONE and SLAB_STORE_USER are always off.

F.e. S/390 will not be able to use slab debug for the general slabs.

You may want to document that change somewhere.


Note that it is not possible to do Redzoning and aligning at the same 
time. Redzoning adds a word before and after the object. If you would 
align it then you would align the whole thing which would result in an 
alignment visible to the slab user of alignment + sizeof(word).

  reply	other threads:[~2006-07-28  2:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 12:15 Pekka J Enberg
2006-07-28  2:25 ` Christoph Lameter [this message]
2006-07-28  6:20   ` Heiko Carstens
2006-07-28 15:19     ` Christoph Lameter

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=Pine.LNX.4.64.0607271909580.15840@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=akpm@osdl.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --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

all inboxes | Powered by JetHome®