[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100415112249.c02c12ba.nishimura@mxp.nes.nec.co.jp>
Date: Thu, 15 Apr 2010 11:22:49 +0900
From: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-mm <linux-mm@...ck.org>,
Mel Gorman <mel@....ul.ie>, Rik van Riel <riel@...hat.com>,
Minchan Kim <minchan.kim@...il.com>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Christoph Lameter <cl@...ux-foundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Daisuke Nishimura <nishimura@....nes.nec.co.jp>
Subject: Re: [RFC][BUGFIX][PATCH] memcg: fix underflow of mapped_file stat
> > > @@ -2517,65 +2519,70 @@ int mem_cgroup_prepare_migration(struct
> > > css_get(&mem->css);
> > > }
> > > unlock_page_cgroup(pc);
> > > -
> > > - if (mem) {
> > > - ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false);
> > > - css_put(&mem->css);
> > > - }
> > > - *ptr = mem;
> > > + /*
> > > + * If the page is uncharged before migration (removed from radix-tree)
> > > + * we return here.
> > > + */
> > > + if (!mem)
> > > + return 0;
> > > + ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, &mem, false);
> > > + css_put(&mem->css); /* drop extra refcnt */
> > it should be:
> >
> > *ptr = mem;
> > ret = __mem_cgroup_try_charge(NULL, GFP_KERNEL, ptr, false);
> > css_put(&mem->css);
> >
> > as Andrea has fixed already.
> >
> Ah, yes. I'll rebase this onto Andrea's fix.
>
>
>
> > > + if (ret)
We should check "if (ret || !*ptr)" not to do commit in !*ptr case.
> > > + * Considering ANON pages, we can't depend on lock_page.
> > > + * If a page may be unmapped before it's remapped, new page's
> > > + * mapcount will not increase. (case that mapcount 0->1 never occur.)
> > > + * PageCgroupUsed() and SwapCache checks will be done.
> > > + *
> > > + * Once mapcount goes to 1, our hook to page_remove_rmap will do
> > > + * enough jobs.
> > > + */
> > > + if (PageAnon(used) && !page_mapped(used))
> > > + mem_cgroup_uncharge_page(used);
> > mem_cgroup_uncharge_page() does the same check :)
> >
> Ok. I'll fix.
>
Considering more, we'd better to check PageAnon() at least not to call
mem_cgroup_uncharge_page() for cache page.
Thanks,
Daisuke Nishimura.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists