Re: [RFC][BUGFIX][PATCH] memcg: fix underflow of mapped_file stat

From: KAMEZAWA Hiroyuki
Date: Tue Apr 13 2010 - 22:00:25 EST


On Wed, 14 Apr 2010 10:40:10 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> On Wed, 14 Apr 2010 10:03:08 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
>
> > > > @@ -2563,6 +2565,15 @@ void mem_cgroup_end_migration(struct mem
> > > > */
> > > > if (ctype == MEM_CGROUP_CHARGE_TYPE_MAPPED)
> > > > mem_cgroup_uncharge_page(target);
> > > > + else {
> > > > + /*
> > > > + * When a migrated file cache is remapped, it's not charged.
> > > > + * Verify it. Because we're under lock_page(), there are
> > > > + * no race with uncharge.
> > > > + */
> > > > + if (page_mapped(target))
> > > > + mem_cgroup_update_file_mapped(mem, target, 1);
> > > > + }
> > > We cannot rely on page lock, because when we succeeded in page migration,
> > > "target" = "newpage" has already unlocked in move_to_new_page(). So the "target"
> > > can be removed from the radix-tree theoretically(it's not related to this
> > > underflow problem, though).
> > > Shouldn't we call lock_page(target) and check "if (!target->mapping)" to handle
> > > this case(maybe in another patch) ?
> > >
> > Sounds reasonable. I think about that.
> >
>

Thinking again....new page is unlocked here. It means the new page may be
removed from radix-tree before commit_charge().

Haha, it seems totally wrong. please wait..

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/