path: root/mm/pgtable-generic.c
diff options
authorMatthew Wilcox <>2017-02-24 14:57:02 -0800
committerLinus Torvalds <>2017-02-24 17:46:54 -0800
commita00cc7d9dd93d66a3fb83fc52aa57a4bec51c517 (patch)
tree54d78e89c63e519cb9e00fdab9efbf3189ef2f5e /mm/pgtable-generic.c
parenta2d581675d485eb7188f521f36efc114639a3096 (diff)
mm, x86: add support for PUD-sized transparent hugepages
The current transparent hugepage code only supports PMDs. This patch adds support for transparent use of PUDs with DAX. It does not include support for anonymous pages. x86 support code also added. Most of this patch simply parallels the work that was done for huge PMDs. The only major difference is how the new ->pud_entry method in mm_walk works. The ->pmd_entry method replaces the ->pte_entry method, whereas the ->pud_entry method works along with either ->pmd_entry or ->pte_entry. The pagewalk code takes care of locking the PUD before calling ->pud_walk, so handlers do not need to worry whether the PUD is stable. [ fix SMP x86 32bit build for native_pud_clear()] Link: [ native_pud_clear missing on i386 build] Link: Link: Signed-off-by: Matthew Wilcox <> Signed-off-by: Dave Jiang <> Tested-by: Alexander Kapshuk <> Cc: Dave Hansen <> Cc: Vlastimil Babka <> Cc: Jan Kara <> Cc: Dan Williams <> Cc: Ross Zwisler <> Cc: Kirill A. Shutemov <> Cc: Nilesh Choudhury <> Cc: Ingo Molnar <> Cc: "H. Peter Anvin" <> Cc: Thomas Gleixner <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/pgtable-generic.c')
1 files changed, 14 insertions, 0 deletions
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index 71c5f9109f2a..4ed5908c65b0 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -123,6 +123,20 @@ pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma, unsigned long address,
flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
return pmd;
+pud_t pudp_huge_clear_flush(struct vm_area_struct *vma, unsigned long address,
+ pud_t *pudp)
+ pud_t pud;
+ VM_BUG_ON(address & ~HPAGE_PUD_MASK);
+ VM_BUG_ON(!pud_trans_huge(*pudp) && !pud_devmap(*pudp));
+ pud = pudp_huge_get_and_clear(vma->vm_mm, address, pudp);
+ flush_pud_tlb_range(vma, address, address + HPAGE_PUD_SIZE);
+ return pud;