On Mon 13-05-13 13:05:24, Sha Zhengju wrote: > From: Sha Zhengju <handai.szj@xxxxxxxxxx> > > Change the first argument of mem_cgroup_{update,inc,dec}_page_stat() from > 'struct page *' to 'struct mem_cgroup *', and so move PageCgroupUsed(pc) > checking out of mem_cgroup_update_page_stat(). This is a prepare patch for > the following memcg page stat lock simplifying. No, please do not do this because it just spreads memcg specific code out of memcontrol.c. Besides that the patch is not correct. [...] > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1109,12 +1109,24 @@ void page_add_file_rmap(struct page *page) > { > bool locked; > unsigned long flags; > + struct page_cgroup *pc; > + struct mem_cgroup *memcg = NULL; > > mem_cgroup_begin_update_page_stat(page, &locked, &flags); > + pc = lookup_page_cgroup(page); > + > + rcu_read_lock(); > + memcg = pc->mem_cgroup; a) unnecessary RCU take for memcg disabled and b) worse KABOOM in that case as page_cgroup is NULL. We really do not want to put mem_cgroup_disabled() tests all over the place. The idea behind mem_cgroup_begin_update_page_stat was to be almost a noop for !memcg (and the real noop for !CONFIG_MEMCG). so Nak to this approach -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html