[PATCH] mmotm: mm-compaction-simplify-__alloc_pages_direct_compact-feedback-interface-fix

From: Michal Hocko
Date: Thu May 12 2016 - 02:10:33 EST


Arnd has reported the following compilation warning:
mm/page_alloc.c: In function '__alloc_pages_nodemask':
mm/page_alloc.c:3651:6: error: 'compact_result' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This should be a false positive TRANSPARENT_HUGEPAGE depends on COMPACTION
so is_thp_gfp_mask shouldn't be true. GFP_TRANSHUGE is a bit tricky
and somebody might be using this accidently. Make sure that compact_result
is defined also for !CONFIG_COMPACT and set it to COMPACT_SKIPPED because
the compaction was really withdrawn.

Reported-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
mm/page_alloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4950d01ff935..0d9008042efa 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3300,6 +3300,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
unsigned int alloc_flags, const struct alloc_context *ac,
enum migrate_mode mode, enum compact_result *compact_result)
{
+ *compact_result = COMPACT_SKIPPED;
return NULL;
}

--
2.8.1

--
Michal Hocko
SUSE Labs