It is pointless to mark huge zero page as freeable.
Let's skip it.

Signed-off-by: Minchan Kim <minc...@kernel.org>
---
 mm/huge_memory.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index f1de4ce583a6..269ed99493f0 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1542,6 +1542,9 @@ int madvise_free_huge_pmd(struct mmu_gather *tlb, struct 
vm_area_struct *vma,
                struct page *page;
                pmd_t orig_pmd;
 
+               if (is_huge_zero_pmd(*pmd))
+                       goto out;
+
                orig_pmd = pmdp_huge_get_and_clear(mm, addr, pmd);
 
                /* No hugepage in swapcache */
@@ -1553,6 +1556,7 @@ int madvise_free_huge_pmd(struct mmu_gather *tlb, struct 
vm_area_struct *vma,
 
                set_pmd_at(mm, addr, pmd, orig_pmd);
                tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
+out:
                spin_unlock(ptl);
                ret = 0;
        }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to