Re: [patch 2/2] mm: memcg: count pte references from every member ofthe reclaimed hierarchy

From: Johannes Weiner
Date: Tue Feb 28 2012 - 21:03:06 EST


On Wed, Feb 29, 2012 at 09:39:46AM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 28 Feb 2012 15:14:49 +0100
> Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -708,7 +708,8 @@ static enum page_references page_check_references(struct page *page,
> > int referenced_ptes, referenced_page;
> > unsigned long vm_flags;
> >
> > - referenced_ptes = page_referenced(page, 1, mz->mem_cgroup, &vm_flags);
> > + referenced_ptes = page_referenced(page, 1, sc->target_mem_cgroup,
> > + &vm_flags);
>
>
> I'm sorry if I don't understand the codes... !sc->target_mem_cgroup case is handled ?

Yes, but it's not obvious from the diff alone. page_referenced() does
this:

/*
* If we are reclaiming on behalf of a cgroup, skip
* counting on behalf of references from different
* cgroups
*/
if (memcg && !mm_match_cgroup(vma->vm_mm, memcg))
continue;

As a result, !sc->target_mem_cgroup -- global reclaim -- will never
ignore references, or put differently, respect references from all
memcgs, which is what we want.
--
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/