From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Menage Subject: Re: [PATCH v8 4/3] cgroups: use flex_array in attach_proc Date: Thu, 3 Mar 2011 09:48:09 -0800 Message-ID: References: <20110208013542.GC31569@ghc17.ghc.andrew.cmu.edu> <20110208013950.GF31569@ghc17.ghc.andrew.cmu.edu> <20110216192200.GA11980@ghc17.ghc.andrew.cmu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20110216192200.GA11980-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org> 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: Ben Blum Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, Miao Xie , David Rientjes , akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org List-Id: containers.vger.kernel.org On Wed, Feb 16, 2011 at 11:22 AM, Ben Blum wrote: > Convert cgroup_attach_proc to use flex_array. > > From: Ben Blum > > The cgroup_attach_proc implementation requires a pre-allocated array to store > task pointers to atomically move a thread-group, but asking for a monolithic > array with kmalloc() may be unreliable for very large groups. Using flex_array > provides the same functionality with less risk of failure. > > This is a post-patch for cgroup-procs-write.patch. > > Signed-off-by: Ben Blum Reviewed-by: Paul Menage Looks fine from a correctness point of view, but I'd be inclined to reduce the verbosity - rather than tsk = flex_array_get_ptr(group, i); BUG_ON(tsk == NULL); retval = ss->can_attach_task(cgrp, tsk); I'd just have retval = ss->can_attach_task(cgrp, flex_array_get_ptr(group, i)); I don't think you need to be so defensive about flex_array's behaviour. Paul