Re: [PATCH 1/1] pagemap clear_refs: modify to specify anon ormapped vma clearing

From: Amerigo Wang
Date: Mon Jul 27 2009 - 23:24:02 EST


On Mon, Jul 27, 2009 at 04:58:20PM -0700, David Rientjes wrote:
>On Mon, 27 Jul 2009, Moussa Ba wrote:
>
>> The other alternative would be to just forgo the additional function
>> clear_refs_walk_vma and rewrite the for loop as:
>>
>> for (vma = mm->mmap; vma; vma = vma->vm_next) {
>> clear_refs_walk.private = vma;
>> if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED)
>> continue;
>> if (is_vm_hugetlb_page(vma))
>> continue;
>> if (type == CLEAR_REFS_ANON && vma->vm_file)
>> continue;
>> if (type == CLEAR_REFS_MAPPED && !vma->vm_file)
>> continue;
>> walk_page_range(vma->vm_start, vma->vm_end, this_walk);
>> }
>>
>
>That looks good, with the exception of the check for
>type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED being in the loop.

And also that it looks like is_vm_hugetlb_page() is already checked
outside, no need to check it again. :-)

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