Re: [RFC] respect the referenced bit of KVM guest pages?
From: KOSAKI Motohiro
Date: Fri Aug 21 2009 - 07:17:58 EST
>> Hmm, I think
>>
>> 1. Anyway, we need turn on PG_mlock.
>
> I add my patch again to explain.
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index ed63894..283266c 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -358,6 +358,7 @@ static int page_referenced_one(struct page *page,
> */
> if (vma->vm_flags & VM_LOCKED) {
> *mapcount = 1; /* break early from loop */
> + *vm_flags |= VM_LOCKED;
> goto out_unmap;
> }
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index d224b28..d156e1d 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -632,7 +632,8 @@ static unsigned long shrink_page_list(struct
> list_head *page_list,
> sc->mem_cgroup, &vm_flags);
> /* In active use or really unfreeable? Activate it. */
> if (sc->order <= PAGE_ALLOC_COSTLY_ORDER &&
> - referenced && page_mapping_inuse(page))
> + referenced && page_mapping_inuse(page)
> + && !(vm_flags & VM_LOCKED))
> goto activate_locked;
>
> By this check, the page can be reached at try_to_unmap after
> page_referenced in shrink_page_list. At that time PG_mlocked will be
> set.
You are right.
Please add my Reviewed-by sign to your patch.
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/