• Ben Blum's avatar
    Add functionality that enables users to move all threads in a threadgroup · aba7244f
    Ben Blum authored
    at once to a cgroup by writing the tgid to the 'cgroup.procs' file.  This
    current implementation makes use of a per-threadgroup rwsem that's taken
    for reading in the fork() path to prevent newly forking threads within the
    threadgroup from "escaping" while the move is in progress.
    
    Cgroups subsystems that need to perform per-thread actions in their
    "attach" callback are (currently) responsible for doing their own
    synchronization, since this occurs outside of the critical section that
    locks against cloning within a thread group.
    Signed-off-by: default avatarBen Blum <bblum@google.com>
    Signed-off-by: default avatarPaul Menage <menage@google.com>
    Acked-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
    Cc: Matt Helsley <matthltc@us.ibm.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    aba7244f
cgroup.c 121 KB