On 03/12/2013 02:11 PM, Sha Zhengju wrote: > Use jump label to patch the memcg page stat accounting code > in or out when not used. when the first non-root memcg comes to > life the code is patching in otherwise it is out. > > Signed-off-by: Sha Zhengju <handai.szj@xxxxxxxxxx> > --- > include/linux/memcontrol.h | 23 +++++++++++++++++++++++ > mm/memcontrol.c | 34 +++++++++++++++++++++++++++++++++- > 2 files changed, 56 insertions(+), 1 deletion(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index d6183f0..99dca91 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -42,6 +42,14 @@ struct mem_cgroup_reclaim_cookie { > }; > > #ifdef CONFIG_MEMCG > + > +extern struct static_key memcg_in_use_key; > + > +static inline bool mem_cgroup_in_use(void) > +{ > + return static_key_false(&memcg_in_use_key); > +} > + I believe the big advantage of the approach I've taken, including this test in mem_cgroup_disabled(), is that we patch out a lot of things for free. We just need to be careful because some code expected that decision to be permanent and now that status can change. But I would still advocate for that. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>