From: Pekka Enberg <penberg@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dave Jones <davej@redhat.com>, Christoph Lameter <cl@linux.com>,
Markus Trippelsdorf <markus@trippelsdorf.de>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Jens Axboe <jaxboe@fusionio.com>,
xtfeng@gmail.com
Subject: Re: list corruption in the last few days. (block ? crypto ?)
Date: Mon, 8 Aug 2011 08:18:45 +0300 (EEST) [thread overview]
Message-ID: <alpine.DEB.2.00.1108080817050.25955@tiger> (raw)
In-Reply-To: <CA+55aFzdp+7+AcCFbx3dCkfqERzYvOZG3c3SUuNAw+X0MJ8iNw@mail.gmail.com>
Hi Linus,
On Sun, Aug 7, 2011 at 11:58 AM, Pekka Enberg <penberg@kernel.org> wrote:
>>
>> Christoph, I've been reading the code and spotted two potential issues in
>> __slab_free(). The first one seems like an off-by-one where our comparison
>> in deactivate_slab() doesn't match __slab_free.
>>
>> The other one is remove_full() call in __slab_free() that can get called
>> even if cache debugging is not enabled.
>>
>> Hmm?
On Sun, 7 Aug 2011, Linus Torvalds wrote:
> I'd like to do -rc1 today, regardless of whether this fixes things or
> not (-rc1 is already a few days delayed).
>
> The patch seems to be a good fix, and a likely candidate for the
> corruption. Commit log and sign-off? I assume you've given it some
> testing, even if you couldn't reproduce the original issue?
No, I haven't tested the patch myself but here's one in proper format in
case someone wants to test it.
Pekka
>From 85380c605764927576d6ef54e4e8a3354df05d47 Mon Sep 17 00:00:00 2001
From: Pekka Enberg <penberg@kernel.org>
Date: Mon, 8 Aug 2011 07:56:49 +0300
Subject: [PATCH] slub: Fix partial and full list handling in __slab_free
Dave Jones and Xiaotian Feng reported SLUB list corruption:
https://lkml.org/lkml/2011/8/4/375
https://lkml.org/lkml/2011/8/3/37
While I haven't able to reproduce the issue, I spotted two problems in
__slab_free() during code review:
- The ->nr_partial check in __slab_free() has an off-by-one bug
when compared to similar check in deactivate_slab()
- remove_full() is called even if cache debugging has not been enabled
Reported-by: Dave Jones <davej@redhat.com>
Reported-by: Xiaotian Feng <xtfeng@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
mm/slub.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index eb5a8f9..cee8c20 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2368,7 +2368,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
if (was_frozen)
stat(s, FREE_FROZEN);
else {
- if (unlikely(!inuse && n->nr_partial > s->min_partial))
+ if (unlikely(!inuse && n->nr_partial >= s->min_partial))
goto slab_empty;
/*
@@ -2376,7 +2376,8 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
* then add it.
*/
if (unlikely(!prior)) {
- remove_full(s, page);
+ if (kmem_cache_debug(s))
+ remove_full(s, page);
add_partial(n, page, 0);
stat(s, FREE_ADD_PARTIAL);
}
--
1.7.0.4
next prev parent reply other threads:[~2011-08-08 5:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 1:00 Dave Jones
2011-08-05 8:46 ` Markus Trippelsdorf
2011-08-05 9:13 ` Pekka Enberg
2011-08-05 9:22 ` Jens Axboe
2011-08-05 9:33 ` Pekka Enberg
2011-08-05 16:32 ` Christoph Lameter
2011-08-05 16:39 ` Dave Jones
2011-08-05 16:47 ` Christoph Lameter
2011-08-05 16:51 ` Dave Jones
2011-08-05 17:01 ` Christoph Lameter
2011-08-05 17:16 ` Dave Jones
2011-08-05 18:14 ` Christoph Lameter
2011-08-05 18:20 ` Dave Jones
2011-08-06 19:31 ` Linus Torvalds
2011-08-07 13:15 ` Pekka Enberg
2011-08-07 18:58 ` Pekka Enberg
2011-08-07 21:13 ` Linus Torvalds
2011-08-08 5:18 ` Pekka Enberg [this message]
2011-08-08 6:12 ` Linus Torvalds
2011-08-08 6:15 ` Xiaotian Feng
2011-08-08 6:14 ` Xiaotian Feng
2011-08-08 6:16 ` Pekka Enberg
2011-08-08 6:34 ` Xiaotian Feng
2011-08-08 6:18 ` Pekka Enberg
2011-08-08 6:31 ` Xiaotian Feng
2011-08-08 6:38 ` Pekka Enberg
2011-08-08 9:18 ` Xiaotian Feng
2011-08-08 14:58 ` Christoph Lameter
2011-08-07 20:36 ` Pekka Enberg
2011-08-05 9:00 ` Xiaotian Feng
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=alpine.DEB.2.00.1108080817050.25955@tiger \
--to=penberg@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=davej@redhat.com \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@trippelsdorf.de \
--cc=torvalds@linux-foundation.org \
--cc=xtfeng@gmail.com \
/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
all inboxes | Powered by JetHome®