]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/madvise.c
mm/huge_memory.c: don't split THP page when MADV_FREE syscall is called
[karo-tx-linux.git] / mm / madvise.c
index 4e945462280149dc8407c216e9b8a82746d40bee..f56825b6d2e103c920d2b21cfb56e316dcea9418 100644 (file)
@@ -271,8 +271,13 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
        pte_t *orig_pte, *pte, ptent;
        struct page *page;
        int nr_swap = 0;
+       unsigned long next;
+
+       next = pmd_addr_end(addr, end);
+       if (pmd_trans_huge(*pmd))
+               if (madvise_free_huge_pmd(tlb, vma, pmd, addr, next))
+                       goto next;
 
-       split_huge_pmd(vma, pmd, addr);
        if (pmd_trans_unstable(pmd))
                return 0;
 
@@ -383,6 +388,7 @@ out:
        arch_leave_lazy_mmu_mode();
        pte_unmap_unlock(orig_pte, ptl);
        cond_resched();
+next:
        return 0;
 }