[Devel] [PATCH rh7] ve: cgroups -- Allow to attach non-self into ve cgroups, v2

Cyrill Gorcunov gorcunov at odin.com
Mon May 18 09:42:50 PDT 2015


On Mon, May 18, 2015 at 07:34:45PM +0300, Vladimir Davydov wrote:
> >  
> >  	/*
> > +	 * We either moving the whole group of threads,
> > +	 * either a single thread process.
> > +	 */
> > +	if (cgroup_taskset_size(tset) == 1) {
> 
> != ?
> 
> > +		task = cgroup_taskset_first(tset);
> > +		if (!thread_group_leader(task) && !thread_group_empty(task))
> > +			return -EINVAL;

No, ==. The thing is that the kernel carries about multithreaded
tasks and groups all threads into the array. In turn, when task
is attached via pid (ie ve/ctid/tasks). the kernel simply looks
up for a task, put it into an array and pass to us. So it's our
duty to check that the only one task has been passed and if so
we need to check it's not a thread from some multithreaded
application.



More information about the Devel mailing list