aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2013-09-11 17:22:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:57:49 -0400
commit83467efbdb7948146581a56cbd683a22a0684bbb (patch)
tree8faaf4d713adcfd5875190ee23f0218212838f24 /include/linux
parentc8721bbbdd36382de51cd6b7a56322e0acca2414 (diff)
mm: migrate: check movability of hugepage in unmap_and_move_huge_page()
Currently hugepage migration works well only for pmd-based hugepages (mainly due to lack of testing,) so we had better not enable migration of other levels of hugepages until we are ready for it. Some users of hugepage migration (mbind, move_pages, and migrate_pages) do page table walk and check pud/pmd_huge() there, so they are safe. But the other users (softoffline and memory hotremove) don't do this, so without this patch they can try to migrate unexpected types of hugepages. To prevent this, we introduce hugepage_migration_support() as an architecture dependent check of whether hugepage are implemented on a pmd basis or not. And on some architecture multiple sizes of hugepages are available, so hugepage_migration_support() also checks hugepage size. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Hillf Danton <dhillf@gmail.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Rik van Riel <riel@redhat.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hugetlb.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 2e02c4ed1035..0393270466c3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -381,6 +381,16 @@ static inline pgoff_t basepage_index(struct page *page)
381 381
382extern void dissolve_free_huge_pages(unsigned long start_pfn, 382extern void dissolve_free_huge_pages(unsigned long start_pfn,
383 unsigned long end_pfn); 383 unsigned long end_pfn);
384int pmd_huge_support(void);
385/*
386 * Currently hugepage migration is enabled only for pmd-based hugepage.
387 * This function will be updated when hugepage migration is more widely
388 * supported.
389 */
390static inline int hugepage_migration_support(struct hstate *h)
391{
392 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
393}
384 394
385#else /* CONFIG_HUGETLB_PAGE */ 395#else /* CONFIG_HUGETLB_PAGE */
386struct hstate {}; 396struct hstate {};
@@ -409,6 +419,8 @@ static inline pgoff_t basepage_index(struct page *page)
409 return page->index; 419 return page->index;
410} 420}
411#define dissolve_free_huge_pages(s, e) do {} while (0) 421#define dissolve_free_huge_pages(s, e) do {} while (0)
422#define pmd_huge_support() 0
423#define hugepage_migration_support(h) 0
412#endif /* CONFIG_HUGETLB_PAGE */ 424#endif /* CONFIG_HUGETLB_PAGE */
413 425
414#endif /* _LINUX_HUGETLB_H */ 426#endif /* _LINUX_HUGETLB_H */