Hi I just want to explain my ideas about file map pages for madvise_free() syscall. As the following patch, For file map vma, there is 2 types: 1. private file map In this type, the pages of this vma are file map pages or anon page (when COW happened), 2. shared file map In this type, the pages of this vma are all file map pages. No matter which type file map, We can handle file map vma as the following: If the page is file map pages, We just clear its pte young bit(pte_mkold()), This will have some advantages, it will make page Reclaim path move this file map page into inactive lru list aggressively. If the page is anon map page, we just handle it in the Same way as for the pages in anon vma. --- diff --git a/mm/madvise.c b/mm/madvise.c index 6d0fcb8..8fdc82f 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -322,7 +322,8 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, ptent = ptep_get_and_clear_full(mm, addr, pte, tlb->fullmm); ptent = pte_mkold(ptent); - ptent = pte_mkclean(ptent); + if (PageAnon(page)) + ptent = pte_mkclean(ptent); set_pte_at(mm, addr, pte, ptent); tlb_remove_tlb_entry(tlb, pte, addr); } @@ -364,10 +365,6 @@ static int madvise_free_single_vma(struct vm_area_struct *vma, if (vma->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)) return -EINVAL; - /* MADV_FREE works for only anon vma at the moment */ - if (vma->vm_file) - return -EINVAL; - start = max(vma->vm_start, start_addr); if (start >= vma->vm_end) return -EINVAL; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href