]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: skip huge zero page in MADV_FREE
authorMinchan Kim <minchan@kernel.org>
Wed, 21 Oct 2015 22:03:47 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:47 +0000 (09:03 +1100)
It is pointless to mark huge zero page as freeable.
Let's skip it.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/huge_memory.c

index 9f6834408c84d2c2756e1a4a93d4e76b6e2830d0..3dab6fa0b0bd06fc4e4dc12cd17cbba2e785e67a 100644 (file)
@@ -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;
        }