Re: [PATCH v4 06/11] memcg: add dirty page accountinginfrastructure

From: KAMEZAWA Hiroyuki
Date: Fri Oct 29 2010 - 07:23:12 EST


On Fri, 29 Oct 2010 19:13:00 +0800
Wu Fengguang <fengguang.wu@xxxxxxxxx> wrote:

> On Fri, Oct 29, 2010 at 03:09:09PM +0800, Greg Thelen wrote:
>
> > +
> > + case MEMCG_NR_FILE_DIRTY:
> > + /* Use Test{Set,Clear} to only un/charge the memcg once. */
> > + if (val > 0) {
> > + if (TestSetPageCgroupFileDirty(pc))
> > + val = 0;
> > + } else {
> > + if (!TestClearPageCgroupFileDirty(pc))
> > + val = 0;
> > + }
>
> I'm wondering why TestSet/TestClear and even the cgroup page flags for
> dirty/writeback/unstable pages are necessary at all (it helps to
> document in changelog if there are any). For example, VFS will call
> TestSetPageDirty() before calling
> mem_cgroup_inc_page_stat(MEMCG_NR_FILE_DIRTY), so there should be no
> chance of false double counting.
>

1. flag is necessary for moving accounting information between cgroups
when account_move() occurs.

2. TestSet... is required because there are always race with page_cgroup_lock()'s
lock bit.

Thanks,
-Kame

--
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/