All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: JoonSoo Kim <js1304@gmail.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	Vegard Nossum <vegard.nossum@gmail.com>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>, Rus <rus@sfinxsoft.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: WARNING: __GFP_FS allocations with IRQs disabled (kmemcheck_alloc_shadow)
Date: Sun, 8 Jul 2012 16:01:44 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1207081558540.18461@chino.kir.corp.google.com> (raw)
In-Reply-To: <CAAmzW4OD2_ODyeY7c1VMPajwzovOms5M8Vnw=XP=uGUyPogiJQ@mail.gmail.com>

On Mon, 9 Jul 2012, JoonSoo Kim wrote:

> 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.)

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.

WARNING: multiple messages have this Message-ID (diff)
From: David Rientjes <rientjes@google.com>
To: JoonSoo Kim <js1304@gmail.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	Vegard Nossum <vegard.nossum@gmail.com>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>, Rus <rus@sfinxsoft.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: WARNING: __GFP_FS allocations with IRQs disabled (kmemcheck_alloc_shadow)
Date: Sun, 8 Jul 2012 16:01:44 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1207081558540.18461@chino.kir.corp.google.com> (raw)
In-Reply-To: <CAAmzW4OD2_ODyeY7c1VMPajwzovOms5M8Vnw=XP=uGUyPogiJQ@mail.gmail.com>

On Mon, 9 Jul 2012, JoonSoo Kim wrote:

> 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.)

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.

--
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>

  reply	other threads:[~2012-07-08 23:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-08  4:00 WARNING: __GFP_FS allocations with IRQs disabled (kmemcheck_alloc_shadow) Fengguang Wu
2012-07-08 16:12 ` JoonSoo Kim
2012-07-08 16:12   ` JoonSoo Kim
2012-07-08 23:01   ` David Rientjes [this message]
2012-07-08 23:01     ` David Rientjes
2012-07-09  1:52     ` Fengguang Wu
2012-07-09  1:52       ` Fengguang Wu
2012-07-09  9:09     ` Pekka Enberg
2012-07-09  9:09       ` Pekka Enberg
2012-07-09 10:36       ` [patch] mm, slub: ensure irqs are enabled for kmemcheck David Rientjes
2012-07-09 10:36         ` David Rientjes
2012-07-09 13:46         ` Steven Rostedt
2012-07-09 13:46           ` Steven Rostedt
2012-07-09 14:06           ` Fengguang Wu
2012-07-09 14:06             ` Fengguang Wu
2012-07-09 21:00           ` [patch v2] " David Rientjes
2012-07-09 21:00             ` David Rientjes
2012-07-10 19:44             ` Pekka Enberg
2012-07-10 19:44               ` Pekka Enberg
2012-07-09 13:52     ` WARNING: __GFP_FS allocations with IRQs disabled (kmemcheck_alloc_shadow) JoonSoo Kim
2012-07-09 13:52       ` JoonSoo Kim
2012-07-09 13:55   ` Christoph Lameter
2012-07-09 13:55     ` Christoph Lameter
2012-07-09 13:52 ` Christoph Lameter

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.1207081558540.18461@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=ben@decadent.org.uk \
    --cc=cl@linux.com \
    --cc=fengguang.wu@intel.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rus@sfinxsoft.com \
    --cc=vegard.nossum@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 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.