path: root/mm/pgtable-generic.c
diff options
authorZi Yan <>2017-09-08 16:10:57 -0700
committerLinus Torvalds <>2017-09-08 18:26:45 -0700
commit616b8371539a6c487404c3b8fb04078016dab4ba (patch)
tree73e4967eee56e07ba8bb7f22e4eac37811a09343 /mm/pgtable-generic.c
parent9c670ea37947a82cb6d4df69139f7e46ed71a0ac (diff)
mm: thp: enable thp migration in generic path
Add thp migration's core code, including conversions between a PMD entry and a swap entry, setting PMD migration entry, removing PMD migration entry, and waiting on PMD migration entries. This patch makes it possible to support thp migration. If you fail to allocate a destination page as a thp, you just split the source thp as we do now, and then enter the normal page migration. If you succeed to allocate destination thp, you enter thp migration. Subsequent patches actually enable thp migration for each caller of page migration by allowing its get_new_page() callback to allocate thps. [ fix gcc-4.9.0 -Wmissing-braces warning] Link: [ fix x86_64 allnoconfig warning] Signed-off-by: Zi Yan <> Acked-by: Kirill A. Shutemov <> Cc: "H. Peter Anvin" <> Cc: Anshuman Khandual <> Cc: Dave Hansen <> Cc: David Nellans <> Cc: Ingo Molnar <> Cc: Mel Gorman <> Cc: Minchan Kim <> Cc: Naoya Horiguchi <> Cc: Thomas Gleixner <> Cc: Vlastimil Babka <> Cc: Andrea Arcangeli <> Cc: Michal Hocko <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/pgtable-generic.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index c99d9512a45b..1175f6a24fdb 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -124,7 +124,8 @@ pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma, unsigned long address,
pmd_t pmd;
- VM_BUG_ON(!pmd_trans_huge(*pmdp) && !pmd_devmap(*pmdp));
+ VM_BUG_ON((pmd_present(*pmdp) && !pmd_trans_huge(*pmdp) &&
+ !pmd_devmap(*pmdp)) || !pmd_present(*pmdp));
pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp);
flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
return pmd;