Skip to contentSkip to conversation

mm: fallback_alloc cpuset_zone_allowed irq fix

PATCH New Paul Jackson 1 participant 1 message Dec 6, 2006 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: fallback_alloc cpuset_zone_allowed irq fix

fallback_alloc() could end up calling cpuset_zone_allowed() with interrupts disabled (by code in kmem_cache_alloc_node()), but without __GFP_HARDWALL set, leading to a possible call of a sleeping function with interrupts disabled.

This results in the BUG report:

  BUG: sleeping function called from invalid context at kernel/cpuset.c:1520

in_atomic():0, irqs_disabled():1

Thanks to Paul Menage for catching this one.

---
 mm/slab.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
mm/slab.c +2 -1
@@ -3261,7 +3261,8 @@ void *fallback_alloc(struct kmem_cache *
 		int nid = zone_to_nid(*z);
 
 		if (zone_idx(*z) <= ZONE_NORMAL &&
-				cpuset_zone_allowed(*z, flags) &&
+				cpuset_zone_allowed(*z,
+					flags | __GFP_HARDWALL) &&
 				cache->nodelists[nid])
 			obj = ____cache_alloc_node(cache,
 					flags | __GFP_THISNODE, nid);
Signature · 9 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>