[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1105311212120.19928@router.home>
Date: Tue, 31 May 2011 12:12:57 -0500 (CDT)
From: Christoph Lameter <cl@...ux.com>
To: David Rientjes <rientjes@...gle.com>
cc: Pekka Enberg <penberg@...helsinki.fi>,
Eric Dumazet <eric.dumazet@...il.com>,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [slubllv6 12/17] slub: Avoid disabling interrupts in free
slowpath
On Thu, 26 May 2011, David Rientjes wrote:
> We know that flags will be initialized at this point in the code, but the
> compiler doesn't and it emits this:
>
> mm/slub.c: In function ‘__slab_free’:
> mm/slub.c:2198: warning: ‘flags’ may be used uninitialized in this function
>
> so it'll need uninitialized_var().
Subject: slub: Disable interrupts in free_debug processing
We will be calling free_debug_processing with interrupts disabled
in some case when the later patches are applied. Some of the
functions called by free_debug_processing expect interrupts to be
off.
Signed-off-by: Christoph Lameter <cl@...ux.com>
---
mm/slub.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2011-05-31 10:20:05.472975031 -0500
+++ linux-2.6/mm/slub.c 2011-05-31 10:20:09.792975006 -0500
@@ -1040,6 +1040,10 @@ bad:
static noinline int free_debug_processing(struct kmem_cache *s,
struct page *page, void *object, unsigned long addr)
{
+ unsigned long flags;
+ int rc = 0;
+
+ local_irq_save(flags);
slab_lock(page);
if (!check_slab(s, page))
@@ -1056,7 +1060,7 @@ static noinline int free_debug_processin
}
if (!check_object(s, page, object, SLUB_RED_ACTIVE))
- return 0;
+ goto out;
if (unlikely(s != page->slab)) {
if (!PageSlab(page)) {
@@ -1077,13 +1081,15 @@ static noinline int free_debug_processin
set_track(s, object, TRACK_FREE, addr);
trace(s, page, object, 0);
init_object(s, object, SLUB_RED_INACTIVE);
+ rc = 1;
+out:
slab_unlock(page);
- return 1;
+ local_irq_restore(flags);
+ return rc;
fail:
slab_fix(s, "Object at 0x%p not freed", object);
- slab_unlock(page);
- return 0;
+ goto out;
}
static int __init setup_slub_debug(char *str)
Powered by blists - more mailing lists