Skip to content

Commit

Permalink
mm, slub: ensure irqs are enabled for kmemcheck
Browse files Browse the repository at this point in the history
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()

Acked-by: Fengguang Wu <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
Tested-by: Fengguang Wu <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
rientjes authored and penberg committed Jul 10, 2012
1 parent 20cea96 commit 737b719
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,13 +1299,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 (kmemcheck_enabled && page
&& !(s->flags & (SLAB_NOTRACK | DEBUG_DEFAULT_FLAGS))) {
int pages = 1 << oo_order(oo);

Expand All @@ -1321,6 +1315,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) ?
Expand Down

0 comments on commit 737b719

Please sign in to comment.