Skip to contentSkip to conversation

use __GFP_NOKILL in mempool_alloc()

PATCH In review William Lee Irwin III 1 participant 1 message Sep 26, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/13 use __GFP_NOKILL in mempool_alloc()

It is permissible to perform mempool allocations with __GFP_FS. While no current caller does so, the following prevents pool->alloc() from invoking the OOM killer when the request is serviceable by just waiting on the mempool.

mm/mempool.c +5 -1
diff -urN linux-2.5.33/mm/mempool.c linux-2.5.33-mm5/mm/mempool.c
@@ -186,8 +186,12 @@
 	void *element;
 	unsigned long flags;
 	DEFINE_WAIT(wait);
-	int gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO);
+	int gfp_nowait;
 	int pf_flags = current->flags;
+
+	gfp_mask |= __GFP_NOKILL;
+
+	gfp_nowait = gfp_mask & ~(__GFP_WAIT | __GFP_IO | __GFP_NOKILL);
 
 repeat_alloc:
 	current->flags |= PF_NOWARN;

--
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/