Commit [31583b]  Maximize  Restore  History

cgroups: fix API thinko

Add cgroup_attach_task_all()

The existing cgroup_attach_task_current_cg() API is called by a thread to
attach another thread to all of its cgroups; this is unsuitable for cases
where a privileged task wants to attach itself to the cgroups of a less
privileged one, since the call must be made from the context of the target

This patch adds a more generic cgroup_attach_task_all() API that allows
both the source task and to-be-moved task to be specified.
cgroup_attach_task_current_cg() becomes a specialization of the more
generic new function.

[ rewrote changelog]
[ address reviewer comments]
Signed-off-by: Michael S. Tsirkin <>
Tested-by: Alex Williamson <>
Acked-by: Paul Menage <>
Cc: Li Zefan <>
Cc: Ben Blum <>
Cc: Sridhar Samudrala <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>

Michael S. Tsirkin Michael S. Tsirkin 2010-09-09

Linus Torvalds Linus Torvalds 2010-09-10

changed include/linux/cgroup.h
changed kernel/cgroup.c
include/linux/cgroup.h Diff Switch to side-by-side view
kernel/cgroup.c Diff Switch to side-by-side view

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks