Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritten (sysfs?)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Christoph Lameter <clameter@...>
Cc: Andrew Morton <akpm@...>, <gregkh@...>, <linux-kernel@...>
Date: Thursday, September 20, 2007 - 6:32 am

On Thu, Sep 20, 2007 at 11:53:53AM +0400, Alexey Dobriyan wrote:

The winner is slub-avoid-touching-page-struct-when-freeing-to-per-cpu-slab.patch
Blind bisecting pointed to it and reverting the patch from full -mm makes
the problem go away

From: Christoph Lameter <clameter@sgi.com>

Set c->node to -1 if we allocate from a debug slab instead for SlabDebug
which requires access the page struct cacheline.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/slub.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN mm/slub.c~slub-avoid-touching-page-struct-when-freeing-to-per-cpu-slab mm/slub.c
--- a/mm/slub.c~slub-avoid-touching-page-struct-when-freeing-to-per-cpu-slab
+++ a/mm/slub.c
@@ -1537,6 +1537,7 @@ debug:
 
 	c->page->inuse++;
 	c->page->freelist = object[c->offset];
+	c->node = -1;
 	slab_unlock(c->page);
 	return object;
 }
@@ -1560,8 +1561,7 @@ static void __always_inline *slab_alloc(
 
 	local_irq_save(flags);
 	c = get_cpu_slab(s, smp_processor_id());
-	if (unlikely(!c->page || !c->freelist ||
-					!node_match(c, node)))
+	if (unlikely(!c->freelist || !node_match(c, node)))
 
 		object = __slab_alloc(s, gfpflags, node, addr, c);
 
@@ -1670,7 +1670,7 @@ static void __always_inline slab_free(st
 	local_irq_save(flags);
 	debug_check_no_locks_freed(object, s->objsize);
 	c = get_cpu_slab(s, smp_processor_id());
-	if (likely(page == c->page && !SlabDebug(page))) {
+	if (likely(page == c->page && c->node >= 0)) {
 		object[c->offset] = c->freelist;
 		c->freelist = object;
 	} else
_

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Christoph Lameter, (Wed Sep 19, 4:59 pm)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Christoph Lameter, (Wed Sep 19, 5:36 pm)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Christoph Lameter, (Thu Sep 20, 1:25 pm)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Christoph Lameter, (Thu Sep 20, 1:37 pm)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Eric W. Biederman, (Thu Sep 20, 2:54 pm)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Alexey Dobriyan, (Thu Sep 20, 6:32 am)
Re: 2.6.23-rc6-mm1: BUG kmalloc-16: Object padding overwritt..., Christoph Lameter, (Thu Sep 20, 1:36 pm)