Skip to contentSkip to conversation

fix bug - when slob allocates "struct kmem_cache", it does not force alignment.

PATCH In review Bryan Wu 4 participants 4 messages Apr 25, 2008 Memory management

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 fix bug - when slob allocates "struct kmem_cache", it does not force alignment.

From: Yi Li <[email protected]>

This may trigger misaligned memory access exception.

---
 mm/slob.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
mm/slob.c +2 -1
index e2c3c0e..6038cba 100644
@@ -533,7 +533,8 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
 {
 	struct kmem_cache *c;
 
-	c = slob_alloc(sizeof(struct kmem_cache), flags, 0, -1);
+	c = slob_alloc(sizeof(struct kmem_cache),
+		flags, ARCH_KMALLOC_MINALIGN, -1);
 
 	if (c) {
 		c->name = name;
Signature · 1 line
1.5.5
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Bryan Wu

From: Yi Li <[email protected]>

This may trigger misaligned memory access exception.

Looks good, thanks. Christoph, do you want to take this or should it go through Andrew?

Quoted 18 lines
---
 mm/slob.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
mm/slob.c +2 -1
index e2c3c0e..6038cba 100644
@@ -533,7 +533,8 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
 {
 	struct kmem_cache *c;
 
-	c = slob_alloc(sizeof(struct kmem_cache), flags, 0, -1);
+	c = slob_alloc(sizeof(struct kmem_cache),
+		flags, ARCH_KMALLOC_MINALIGN, -1);
 
 	if (c) {
 		c->name = name;
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#3 lore raw
In reply to Matt Mackall
Quoted 2 lines · Matt Mackall

Looks good, thanks. Christoph, do you want to take this or should it go through Andrew?

Pekka is handling the slab trees and it seems that he picked it up.