mm: Fix infinite loop when offlining

When page migration is unable to find free memory it
will go into an infinite loop because the
all_unreclaimable flag is never set.

This change will allow memory offlining to fail
gracefully if there is not enough memory for page
migration.

__GFP_NORETRY tells the page_alloc to not retry.
__GFP_NOWARN suppresses page fault warnings when
page allocation fails.
__GFP_NOMEMALLOC prevents it from aggressively
allocating beyond zone watermarks.

Change-Id: I94dfd9059851c7b24953f44a4018a3bbac840688
Signed-off-by: Jack Cheung <jackc@codeaurora.org>
This commit is contained in:
Jack Cheung
2011-11-21 16:44:05 -08:00
parent e2edeb1d2b
commit 1e6ec3c7e3

View File

@@ -753,7 +753,8 @@ static struct page *
hotremove_migrate_alloc(struct page *page, unsigned long private, int **x)
{
/* This should be improooooved!! */
return alloc_page(GFP_HIGHUSER_MOVABLE);
return alloc_page(GFP_HIGHUSER_MOVABLE | __GFP_NORETRY | __GFP_NOWARN |
__GFP_NOMEMALLOC);
}
#define NR_OFFLINE_AT_ONCE_PAGES (256)