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

Vladimir Davydov vdavydov at parallels.com
Mon May 18 10:41:33 PDT 2015


On Mon, May 18, 2015 at 07:42:50PM +0300, Cyrill Gorcunov wrote:
> 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.
> 

OK, I see, thanks.

But if we are attaching one thread which is thread_group_leader, we will
not fail even if the thread group is not empty and other threads are not
moved, will we?



More information about the Devel mailing list