All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: James Morris <jmorris@namei.org>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Revert "slub: Remove node check in slab_free"
Date: Wed, 25 May 2011 10:58:16 +0200	[thread overview]
Message-ID: <20110525085816.GA24233@elte.hu> (raw)
In-Reply-To: <20110525074040.GA9233@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> 
> * James Morris <jmorris@namei.org> wrote:
> 
> > I started experiencing a boot hang in 2.6.39+, and bisected it to this 
> > change:
> 
> i too was seeing various instabilities and SLUB corruption in -tip testing. 
> Every 5th randconfig kernel crashes.
> 
> I started testing the revert.

Stability of -tip has increased dramatically (36 test iterations and 
no crash), so yes this revert resolves the crashes.

I've attached the changelogified revert patch below. James, since i 
was seeing these sporadically you've saved me a couple of hours of 
rather painful bisection work! :-)

Thanks,

	Ingo

----------------->
>From 6ac0730862b6dd1b45bc86e8e61e4026293b09f9 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Wed, 25 May 2011 09:37:47 +0200
Subject: [PATCH] Revert "slub: Remove node check in slab_free"

This reverts commit 442b06bcea23a01934d3da7ec5898fa154a6cafb.

As Linus explained it's broken. Quoting Linus:

That whole "deactivate_slab()" + "c->page = NULL" that this patch 
does looks bogus.

Look at __slab_alloc(), we have:

        page = c->page;
        if (!page)
                goto new_slab;

        slab_lock(page);
        if (unlikely(!node_match(c, node)))
                goto another_slab;

and let's assume we have two users racing on that "c->page". The 
"slab_lock()" is going to work for one of them, right?

Ok, so the one it works for will then hit:

        if (kmem_cache_debug(s))
                goto debug;

and thus get to the new "deactivate_slab(s,c) + c->page = NULL" and 
then unlock the page.

In the meantime, the one that wasn't able to lock the page will now 
go forward, but will not have "node_match()" any more, so it does 
that "goto another_slab".

Which does "deactivate_slab(s,c)" again, and now c->page is NULL, so 
that totally breaks.

Reported-and-bisected-by: James Morris <jmorris@namei.org>
Analyzed-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Link: http://lkml.kernel.org/r/alpine.LRH.2.00.1105242146240.12134@tundra.namei.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 mm/slub.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 4ea7f1a..ed1281b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1881,8 +1881,6 @@ debug:
 
 	page->inuse++;
 	page->freelist = get_freepointer(s, object);
-	deactivate_slab(s, c);
-	c->page = NULL;
 	c->node = NUMA_NO_NODE;
 	goto unlock_out;
 }
@@ -2114,7 +2112,7 @@ redo:
 	tid = c->tid;
 	barrier();
 
-	if (likely(page == c->page)) {
+	if (likely(page == c->page && c->node != NUMA_NO_NODE)) {
 		set_freepointer(s, object, c->freelist);
 
 		if (unlikely(!irqsafe_cpu_cmpxchg_double(

  reply	other threads:[~2011-05-25  8:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 11:52 SLUB regression in current Linus James Morris
2011-05-24 12:04 ` James Morris
2011-05-24 14:08   ` Christoph Lameter
2011-05-24 22:15     ` James Morris
2011-05-25 14:47       ` Christoph Lameter
2011-05-25 14:57         ` Linus Torvalds
2011-05-25 15:04           ` Christoph Lameter
2011-05-25 15:45             ` Eric Dumazet
2011-05-25 16:31               ` Christoph Lameter
2011-05-25 15:42         ` Eric Dumazet
2011-05-25 16:29           ` Christoph Lameter
2011-05-24 23:03 ` Linus Torvalds
2011-05-25  5:22   ` Pekka Enberg
2011-05-25 14:25   ` Christoph Lameter
2011-05-25  7:40 ` Ingo Molnar
2011-05-25  8:58   ` Ingo Molnar [this message]
2011-05-25 11:13     ` [PATCH] Revert "slub: Remove node check in slab_free" Pekka Enberg
2011-05-25 14:54     ` Linus Torvalds
2011-05-25 12:42   ` SLUB regression in current Linus Jens Axboe
2011-05-25 23:53     ` David Rientjes

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=20110525085816.GA24233@elte.hu \
    --to=mingo@elte.hu \
    --cc=cl@linux.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.