From 60c6791df949e6ef790a63552e283a747f9d636d Mon Sep 17 00:00:00 2001 From: Sung-hun Kim Date: Fri, 1 Oct 2021 13:06:07 +0900 Subject: [PATCH] mm, thp: do not set PTE_SPECIAL for huge zero page In previous version of the kernel, a huge zero page is remapped to normal pte mappings with PTE_SPECIAL flag when the split of hugepage is requested. It makes a buggy situation when the kernel tries to find a page with vm_normal_page. This patch resolves this problem by adding a condition to if- statement. Change-Id: I62946d3c3e92be309ccbe987f24a33503a7e23dc Signed-off-by: Sung-hun Kim --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index efc73a0..18bdc8c 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2278,7 +2278,7 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, repeat: #ifdef CONFIG_FINEGRAINED_THP - if (pmd_trans_huge(*pmd) && !vm_normal_page_pmd(vma, address, *pmd)) { + if (pmd_trans_huge(*pmd) && !vm_normal_page_pmd(vma, address, *pmd) && !is_huge_zero_pmd(*pmd)) { struct mm_struct *mm = vma->vm_mm; unsigned long haddr = address & HPAGE_PMD_MASK; pmd_t orig_pmd; -- 2.7.4