summaryrefslogtreecommitdiff
path: root/include/linux/migrate.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/migrate.h')
-rw-r--r--include/linux/migrate.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 48e24844b3c5..3e0d405dc842 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -4,6 +4,7 @@
#include <linux/mm.h>
#include <linux/mempolicy.h>
#include <linux/migrate_mode.h>
+#include <linux/hugetlb.h>
typedef struct page *new_page_t(struct page *page, unsigned long private,
int **reason);
@@ -30,6 +31,21 @@ enum migrate_reason {
/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */
extern char *migrate_reason_names[MR_TYPES];
+static inline struct page *new_page_nodemask(struct page *page,
+ int preferred_nid, nodemask_t *nodemask)
+{
+ gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL;
+
+ if (PageHuge(page))
+ return alloc_huge_page_nodemask(page_hstate(compound_head(page)),
+ preferred_nid, nodemask);
+
+ if (PageHighMem(page) || (zone_idx(page_zone(page)) == ZONE_MOVABLE))
+ gfp_mask |= __GFP_HIGHMEM;
+
+ return __alloc_pages_nodemask(gfp_mask, 0, preferred_nid, nodemask);
+}
+
#ifdef CONFIG_MIGRATION
extern void putback_movable_pages(struct list_head *l);