public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] FRV: Specify the minimum slab/kmalloc alignment
@ 2008-05-28 14:36 David Howells
  2008-05-28 15:49 ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2008-05-28 14:36 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: penberg, dhowells, linux-kernel

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.

Signed-off-by: David Howells <dhowells@redhat.com>
---

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


diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
index 734a1d0..8a15c90 100644
--- a/include/asm-frv/mem-layout.h
+++ b/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		(sizeof(long) * 2)
+#define	ARCH_SLAB_MINALIGN		(sizeof(long) * 2)
+
 /*****************************************************************************/
 /*
  * virtual memory layout from kernel's point of view


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

* Re: [PATCH] FRV: Specify the minimum slab/kmalloc alignment
  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
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2008-05-28 15:49 UTC (permalink / raw)
  Cc: dhowells, torvalds, akpm, penberg, linux-kernel

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.

David

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

* Re: [PATCH] FRV: Specify the minimum slab/kmalloc alignment
  2008-05-28 15:49 ` David Howells
@ 2008-05-28 19:15   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2008-05-28 19:15 UTC (permalink / raw)
  To: David Howells; +Cc: dhowells, torvalds, penberg, linux-kernel

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
_


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

end of thread, other threads:[~2008-05-28 19:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox