public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Howells <dhowells@redhat.com>
Cc: dhowells@redhat.com, torvalds@linux-foundation.org,
	penberg@cs.helsinki.fi, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] FRV: Specify the minimum slab/kmalloc alignment
Date: Wed, 28 May 2008 12:15:35 -0700	[thread overview]
Message-ID: <20080528121535.bf766e95.akpm@linux-foundation.org> (raw)
In-Reply-To: <25268.1211989741@redhat.com>

On Wed, 28 May 2008 16:49:01 +0100
David Howells <dhowells@redhat.com> wrote:

> David Howells <dhowells@redhat.com> wrote:
> 
> > +#define	ARCH_KMALLOC_MINALIGN		(sizeof(long) * 2)
> > +#define	ARCH_SLAB_MINALIGN		(sizeof(long) * 2)
> 
> This doesn't work if SLAB is selected and slab debugging is enabled as these
> are passed to the preprocessor.
> 

So.. like this?

From: David Howells <dhowells@redhat.com>

Specify the minimum slab/kmalloc alignment to be 8 bytes.  This fixes a
crash when SLOB is selected as the memory allocator.  The FRV arch needs
this so that it can use the load- and store-double instructions without
faulting.  By default SLOB sets the minimum to be 4 bytes.

We need to use literal constants here as slab evaluates these within cpp.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/asm-frv/mem-layout.h |    7 +++++++
 1 file changed, 7 insertions(+)

diff -puN include/asm-frv/mem-layout.h~frv-specify-the-minimum-slab-kmalloc-alignment include/asm-frv/mem-layout.h
--- a/include/asm-frv/mem-layout.h~frv-specify-the-minimum-slab-kmalloc-alignment
+++ a/include/asm-frv/mem-layout.h
@@ -31,6 +31,13 @@
 
 #define PAGE_MASK			(~(PAGE_SIZE-1))
 
+/*
+ * the slab must be aligned such that load- and store-double instructions don't
+ * fault if used
+ */
+#define	ARCH_KMALLOC_MINALIGN		8 /* (sizeof(long) * 2) */
+#define	ARCH_SLAB_MINALIGN		8 /* (sizeof(long) * 2) */
+
 /*****************************************************************************/
 /*
  * virtual memory layout from kernel's point of view
_


      reply	other threads:[~2008-05-28 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 14:36 [PATCH] FRV: Specify the minimum slab/kmalloc alignment David Howells
2008-05-28 15:49 ` David Howells
2008-05-28 19:15   ` Andrew Morton [this message]

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=20080528121535.bf766e95.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@linux-foundation.org \
    /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