linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>, JoonSoo Kim <js1304@gmail.com>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Vegard Nossum <vegard.nossum@gmail.com>,
	Christoph Lameter <cl@linux.com>, Rus <rus@sfinxsoft.com>,
	Ben Hutchings <ben@decadent.org.uk>,
	stable@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] mm, slub: ensure irqs are enabled for kmemcheck
Date: Mon, 09 Jul 2012 09:46:33 -0400	[thread overview]
Message-ID: <1341841593.14828.9.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1207090333560.8224@chino.kir.corp.google.com>

On Mon, 2012-07-09 at 03:36 -0700, David Rientjes wrote:
> kmemcheck_alloc_shadow() requires irqs to be enabled, so wait to disable
> them until after its called for __GFP_WAIT allocations.
> 
> This fixes a warning for such allocations:
> 
> 	WARNING: at kernel/lockdep.c:2739 lockdep_trace_alloc+0x14e/0x1c0()
> 
> Cc: stable@vger.kernel.org [3.1+]
> Acked-by: Fengguang Wu <fengguang.wu@intel.com>
> Tested-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  mm/slub.c |   13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1314,13 +1314,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
>  			stat(s, ORDER_FALLBACK);
>  	}
>  
> -	if (flags & __GFP_WAIT)
> -		local_irq_disable();
> -
> -	if (!page)
> -		return NULL;
> -
> -	if (kmemcheck_enabled
> +	if (page && kmemcheck_enabled

One micro-optimization nit...

If kmemcheck_enabled is mostly false, and page is mostly true, wouldn't
it be better to swap the two?

	if (kmemcheck_enabled && page

Then the first check would just short-circuit out and we don't do the
double check.

Otherwise it looks good.

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

>  		&& !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
>  		int pages = 1 << oo_order(oo);
>  
> @@ -1336,6 +1330,11 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
>  			kmemcheck_mark_unallocated_pages(page, pages);
>  	}
>  
> +	if (flags & __GFP_WAIT)
> +		local_irq_disable();
> +	if (!page)
> +		return NULL;
> +
>  	page->objects = oo_objects(oo);
>  	mod_zone_page_state(page_zone(page),
>  		(s->flags & SLAB_RECLAIM_ACCOUNT) ?


--
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-09 13:46 UTC|newest]

Thread overview: 13+ 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 23:01   ` David Rientjes
2012-07-09  1:52     ` Fengguang Wu
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 13:46         ` Steven Rostedt [this message]
2012-07-09 14:06           ` Fengguang Wu
2012-07-09 21:00           ` [patch v2] " David Rientjes
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: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=1341841593.14828.9.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --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=rientjes@google.com \
    --cc=rus@sfinxsoft.com \
    --cc=stable@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox