summaryrefslogtreecommitdiff
path: root/include/linux/migrate.h
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-07-25 03:44:18 +0300
committerJames Morris <james.l.morris@oracle.com>2017-07-25 03:44:18 +0300
commit53a2ebaaabc1eb8458796fec3bc1e0e80746b642 (patch)
tree9d1f9227b49392cdd2edcc01057517da4f4b09c2 /include/linux/migrate.h
parent3cf29931453215536916d0c4da953fce1911ced3 (diff)
parent520eccdfe187591a51ea9ab4c1a024ae4d0f68d9 (diff)
downloadlinux-53a2ebaaabc1eb8458796fec3bc1e0e80746b642.tar.xz
sync to Linus v4.13-rc2 for subsystem developers to work against
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);