From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mandeep Singh Baines Subject: Re: [PATCH 3/3] cgroup: remove extra calls to find_existing_css_set Date: Fri, 20 Jan 2012 18:57:12 -0800 Message-ID: <20120121025712.GB4656@google.com> References: <1325654312-32477-1-git-send-email-msb@chromium.org> <1325654312-32477-3-git-send-email-msb@chromium.org> <20120121000842.GB2908@dhcp-172-17-108-109.mtv.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120121000842.GB2908-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Tejun Heo Cc: Frederic Weisbecker , Mandeep Singh Baines , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Oleg Nesterov , Paul Menage , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andrew Morton , containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: containers.vger.kernel.org Tejun Heo (tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org) wrote: > On Tue, Jan 03, 2012 at 09:18:32PM -0800, Mandeep Singh Baines wrote: > > +out_put_css_set_refs: > > + if (retval) { > > + for (i = 0; i < css_set_refs; i++) { > > + tc = flex_array_get(group, i); > > + put_css_set(tc->cg); > > Why not the following > > for (i = 0; i < group_size; i++) { > tc = flex_array_get(group, i); > if (tc) > put_css_set(tc->cg); > } > > and remove css_set_refs? > If I break out of step 2 via the goto (out_put_css_set_refs), I only want to put back the refs I've gotten so far. I could reset group_size in that case but wanted avoid overloading group_size: someone could later add more error path code that isn't expecting that group_size will get re-assigned and have its meaning change. Regards, Mandeep > Thanks > > -- > tejun