From: Christoph Lameter Date: Wed, 13 Dec 2006 08:34:11 +0000 (-0800) Subject: [PATCH] slab: fix sleeping in atomic bug X-Git-Tag: v2.6.20-rc1~115 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd47ea755693228bf842c779e8afdfa47efb20a3;p=linux-2.6 [PATCH] slab: fix sleeping in atomic bug 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 Cc: Jay Cliburn Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index 2c655532f5..c7576b9027 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -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: /* @@ -3275,7 +3276,12 @@ retry: * 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