Skip to content

Commit

Permalink
[PATCH] slab: fix sleeping in atomic bug
Browse files Browse the repository at this point in the history
Fallback_alloc() does not do the check for GFP_WAIT as done in
cache_grow().  Thus interrupts are disabled when we call kmem_getpages()
which results in the failure.

Duplicate the handling of GFP_WAIT in cache_grow().

Signed-off-by: Christoph Lameter <[email protected]>
Cc: Jay Cliburn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Dec 13, 2006
1 parent 6a8ba9d commit dd47ea7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3252,6 +3252,7 @@ void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
struct zone **z;
void *obj = NULL;
int nid;
gfp_t local_flags = (flags & GFP_LEVEL_MASK);

retry:
/*
Expand All @@ -3275,7 +3276,12 @@ void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
* We may trigger various forms of reclaim on the allowed
* set and go into memory reserves if necessary.
*/
if (local_flags & __GFP_WAIT)
local_irq_enable();
kmem_flagcheck(cache, flags);
obj = kmem_getpages(cache, flags, -1);
if (local_flags & __GFP_WAIT)
local_irq_disable();
if (obj) {
/*
* Insert into the appropriate per node queues
Expand Down

0 comments on commit dd47ea7

Please sign in to comment.