linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/buddy: cleanup on should_fail_alloc_page
@ 2012-06-09 14:51 Gavin Shan
  2012-06-10 20:50 ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Gavin Shan @ 2012-06-09 14:51 UTC (permalink / raw)
  To: linux-mm; +Cc: hannes, akpm, Gavin Shan

In the core function __alloc_pages_nodemask() of buddy allocator, it's
possible for the memory allocation to fail. That's probablly caused
by error injection with expection. In that case, it depends on the
check of error injection covered by function should_fail(). Currently,
function should_fail() has "bool" for its return value, so it's reasonable
to change the return value of function should_fail_alloc_page() into
"bool" as well.

The patch does cleanup on function should_fail_alloc_page() to "bool".

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 mm/page_alloc.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4403009..7892f84 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1529,16 +1529,16 @@ static int __init setup_fail_page_alloc(char *str)
 }
 __setup("fail_page_alloc=", setup_fail_page_alloc);
 
-static int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
+static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
 {
 	if (order < fail_page_alloc.min_order)
-		return 0;
+		return false;
 	if (gfp_mask & __GFP_NOFAIL)
-		return 0;
+		return false;
 	if (fail_page_alloc.ignore_gfp_highmem && (gfp_mask & __GFP_HIGHMEM))
-		return 0;
+		return false;
 	if (fail_page_alloc.ignore_gfp_wait && (gfp_mask & __GFP_WAIT))
-		return 0;
+		return false;
 
 	return should_fail(&fail_page_alloc.attr, 1 << order);
 }
@@ -1578,9 +1578,9 @@ late_initcall(fail_page_alloc_debugfs);
 
 #else /* CONFIG_FAIL_PAGE_ALLOC */
 
-static inline int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
+static inline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
 {
-	return 0;
+	return false;
 }
 
 #endif /* CONFIG_FAIL_PAGE_ALLOC */
-- 
1.7.9.5

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

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

end of thread, other threads:[~2012-06-11  3:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-09 14:51 [PATCH] mm/buddy: cleanup on should_fail_alloc_page Gavin Shan
2012-06-10 20:50 ` David Rientjes
2012-06-11  3:40   ` Gavin Shan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).