All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation.
@ 2013-07-22 11:32 ` Pintu Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Pintu Kumar @ 2013-07-22 11:32 UTC (permalink / raw)
  To: akpm, mgorman, jiang.liu, minchan, cody, linux-mm, linux-kernel
  Cc: cpgs, pintu.k, pintu_agarwal

It was observed that if order is passed as more than MAX_ORDER
allocation in __alloc_pages_nodemask, it will unnecessarily go to
slowpath and then return failure.
Since we know that more than MAX_ORDER will anyways fail, we can
avoid slowpath by returning failure in nodemask itself.

Signed-off-by: Pintu Kumar <pintu.k@samsung.com>
---
 mm/page_alloc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 202ab58..6d38e75 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1564,6 +1564,10 @@ __setup("fail_page_alloc=", setup_fail_page_alloc);
 
 static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
 {
+	if (order >= MAX_ORDER) {
+		WARN_ON(!(gfp_mask & __GFP_NOWARN));
+		return false;
+	}
 	if (order < fail_page_alloc.min_order)
 		return false;
 	if (gfp_mask & __GFP_NOFAIL)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-23  4:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 11:32 [PATCH 2/2] mm: page_alloc: avoid slowpath for more than MAX_ORDER allocation Pintu Kumar
2013-07-22 11:32 ` Pintu Kumar
2013-07-22 16:38 ` Johannes Weiner
2013-07-22 16:38   ` Johannes Weiner
2013-07-23  2:01   ` PINTU KUMAR
2013-07-23  2:01     ` PINTU KUMAR
2013-07-23  4:35     ` Johannes Weiner
2013-07-23  4:35       ` Johannes Weiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.