lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 22 Dec 2011 10:44:39 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Mandeep Singh Baines <msb@...omium.org>, Tejun Heo <tj@...nel.org>,
	linux-kernel@...r.kernel.org,
	containers@...ts.linux-foundation.org, cgroups@...r.kernel.org,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Menage <paul@...lmenage.org>
Subject: Re: [PATCH 4/4] cgroup: remove extra calls to find_existing_css_set

On Thu, Dec 22, 2011 at 01:50:46PM +0800, Li Zefan wrote:
> > @@ -2091,6 +2010,10 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> >  	 * rcu or tasklist locked. instead, build an array of all threads in the
> >  	 * group - group_rwsem prevents new threads from appearing, and if
> >  	 * threads exit, this will just be an over-estimate.
> > +	 *
> > +	 * While creating the list, also make sure css_sets exist for all
> > +	 * threads to be migrated. we use find_css_set, which allocates a new
> > +	 * one if necessary.
> >  	 */
> >  	group_size = get_nr_threads(leader);
> >  	/* flex_array supports very large thread-groups better than kmalloc. */
> > @@ -2137,6 +2060,12 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
> >  		/* nothing to do if this task is already in the cgroup */
> >  		if (ent.cgrp == cgrp)
> >  			continue;
> > +		ent.cg = find_css_set(tsk->cgroups, cgrp);
> 
> unfortunately This won't work, because we are holding tasklist_lock.

I believe we can remove tasklist_lock now (in a seperate patch).

It was there in order to protect while_each_thread() against exec but
now we have threadgroup_lock().

I think we only need to use rcu_read_lock() to protect against concurrent
removal in exit.
 
> > +		if (!ent.cg) {
> > +			retval = -ENOMEM;
> > +			group_size = i;
> > +			goto out_list_teardown;
> > +		}
> >  		retval = flex_array_put(group, i, &ent, GFP_ATOMIC);
> >  		BUG_ON(retval != 0);
> >  		i++;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ