From: Michal Hocko Subject: Re: [PATCH v3 3/4] memcg: optimize memcg_get_hierarchical_limit Date: Mon, 25 Jun 2012 11:46:50 +0200 Message-ID: <20120625094649.GF19805@tiehlicka.suse.cz> References: <1340613872-9581-1-git-send-email-liwp.linux@gmail.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <1340613872-9581-1-git-send-email-liwp.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Wanpeng Li Cc: Johannes Weiner , KAMEZAWA Hiroyuki , Balbir Singh , Andrew Morton , Eric Dumazet , Mike Frysinger , Arun Sharma , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Mon 25-06-12 16:44:32, Wanpeng Li wrote: > From: Wanpeng Li > > Optimize memcg_get_hierarchical_limit to save cpu cycle. How did you check that this actually saves some cycles? There are no (compiler) barriers here so it should reordered. > Signed-off-by: Wanpeng Li > --- > mm/memcontrol.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 2e81328..4520b57 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -3917,9 +3917,9 @@ static void memcg_get_hierarchical_limit(struct mem_cgroup *memcg, > > min_limit = res_counter_read_u64(&memcg->res, RES_LIMIT); > min_memsw_limit = res_counter_read_u64(&memcg->memsw, RES_LIMIT); > - cgroup = memcg->css.cgroup; > if (!memcg->use_hierarchy) > goto out; > + cgroup = memcg->css.cgroup; > > while (cgroup->parent) { > cgroup = cgroup->parent; > -- > 1.7.9.5 > -- Michal Hocko SUSE Labs SUSE LINUX s.r.o. Lihovarska 1060/12 190 00 Praha 9 Czech Republic