From 5b701b846aad7909d20693bcced2522d0ce8d1bc Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Tue, 8 Sep 2015 14:59:28 -0700 Subject: [PATCH] thp: decrement refcount on huge zero page if it is split The DAX code neglected to put the refcount on the huge zero page. Also we must notify on splits. Signed-off-by: Kirill A. Shutemov Signed-off-by: Matthew Wilcox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 5df0d1597c15..7510b6f683e9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2978,7 +2978,9 @@ void __split_huge_page_pmd(struct vm_area_struct *vma, unsigned long address, if (unlikely(!pmd_trans_huge(*pmd))) goto unlock; if (vma_is_dax(vma)) { - pmdp_huge_clear_flush(vma, haddr, pmd); + pmd_t _pmd = pmdp_huge_clear_flush_notify(vma, haddr, pmd); + if (is_huge_zero_pmd(_pmd)) + put_huge_zero_page(); } else if (is_huge_zero_pmd(*pmd)) { __split_huge_zero_page_pmd(vma, haddr, pmd); } else { -- GitLab