Thread (13 messages) 13 messages, 6 authors, 2012-07-10

Re: WARNING: __GFP_FS allocations with IRQs disabled (kmemcheck_alloc_shadow)

From: JoonSoo Kim <hidden>
Date: 2012-07-09 13:52:43
Also in: lkml

2012/7/9 David Rientjes [off-list ref]:
On Mon, 9 Jul 2012, JoonSoo Kim wrote:
quoted
diff --git a/mm/slub.c b/mm/slub.c
index 8c691fa..5d41cad 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1324,8 +1324,14 @@ static struct page *allocate_slab(struct
kmem_cache *s, gfp_t flags, int node)
                && !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
                int pages = 1 << oo_order(oo);

+               if (flags & __GFP_WAIT)
+                       local_irq_enable();
+
                kmemcheck_alloc_shadow(page, oo_order(oo), flags, node);

+               if (flags & __GFP_WAIT)
+                       local_irq_disable();
+
                /*
                 * Objects from caches that have a constructor don't get
                 * cleared when they're allocated, so we need to do it here.
This patch is suboptimal when the branch is taken since you just disabled
irqs and now are immediately reenabling them and then disabling them
again.  (And your patch is also whitespace damaged, has no changelog, and
isn't signed off so it can't be applied.)
My intent is just to provide reference, because there is no replay to
this thread when I see it.

The correct fix is what I proposed at
http://marc.info/?l=linux-kernel&m=133754837703630 and was awaiting
testing.  If Rus, Steven, or Fengguang could test this then we could add
it as a stable backport as well.
Your patch looks good to me.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help