[PATCH 0/2] CGroups: cgroup member list enhancement/fix

Benjamin Blum bblum at google.com
Tue Jul 14 10:34:10 PDT 2009

On Tue, Jul 14, 2009 at 3:16 AM, Balbir Singh<balbir at linux.vnet.ibm.com> wrote:
> * menage at google.com <menage at google.com> [2009-07-13 23:49:16]:
>> As a first cut, we were planning to add an rwsem that gets taken for
>> read in cgroup_fork(), released in cgroup_post_fork(), and taken for
>> write when moving an entire process to a new cgroup; not ideal
>> performance-wise, but safe.
>> If adding a field to task_struct is an option, then the rwsem could be
>> per thread-group leader, which would reduce contention.

That would indeed help, but would only improve system-wide performance
in the case with write-contention (no improvement at all if, say, the
threadgroup is the only one forking, or when nobody is writing to the
procs file). While that's preferable to a global lock, if we can add a
field to task_struct, a (lockless) flag-based approach might be

> We should also document that moving large processes with several
> threads can be expensive.

Indeed. Or more specifically, that moving fast-growing threadgroups
can be expensive.

More information about the Containers mailing list