* [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
@ 2010-07-30 23:56 Ben Blum
0 siblings, 0 replies; 8+ messages in thread
From: Ben Blum @ 2010-07-30 23:56 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: bblum-OM76b2Iv3yLQjUSlxSEPGw, oleg-H+wXaHxf7aLQT0dZR+AlfA,
ebiederm-aS9lmoZGLiVWk0Htik3J/w, menage-hpIqsD4AKlfQT0dZR+AlfA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
This patch series is a revision of http://lkml.org/lkml/2010/6/25/11 .
This patch series implements a write function for the 'cgroup.procs'
per-cgroup file, which enables atomic movement of multithreaded
applications between cgroups. Writing the thread-ID of any thread in a
threadgroup to a cgroup's procs file causes all threads in the group to
be moved to that cgroup safely with respect to threads forking/exiting.
(Possible usage scenario: If running a multithreaded build system that
sucks up system resources, this lets you restrict it all at once into a
new cgroup to keep it under control.)
Example: Suppose pid 31337 clones new threads 31338 and 31339.
# cat /dev/cgroup/tasks
...
31337
31338
31339
# mkdir /dev/cgroup/foo
# echo 31337 > /dev/cgroup/foo/cgroup.procs
# cat /dev/cgroup/foo/tasks
31337
31338
31339
A new lock, called threadgroup_fork_lock and living in signal_struct, is
introduced to ensure atomicity when moving threads between cgroups. It's
taken for writing during the operation, and taking for reading in fork()
around the calls to cgroup_fork() and cgroup_post_fork(). I put calls to
down_read/up_read directly in copy_process(), since new inline functions
seemed like overkill.
-- Ben
---
Documentation/cgroups/cgroups.txt | 13 -
include/linux/init_task.h | 9
include/linux/sched.h | 10
kernel/cgroup.c | 426 +++++++++++++++++++++++++++++++++-----
kernel/cgroup_freezer.c | 4
kernel/cpuset.c | 4
kernel/fork.c | 16 +
kernel/ns_cgroup.c | 4
kernel/sched.c | 4
9 files changed, 440 insertions(+), 50 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
@ 2010-07-30 23:56 Ben Blum
[not found] ` <20100730235649.GA22644-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org>
2010-08-03 19:58 ` Andrew Morton
0 siblings, 2 replies; 8+ messages in thread
From: Ben Blum @ 2010-07-30 23:56 UTC (permalink / raw)
To: linux-kernel, containers
Cc: akpm, bblum, ebiederm, lizf, matthltc, menage, oleg
This patch series is a revision of http://lkml.org/lkml/2010/6/25/11 .
This patch series implements a write function for the 'cgroup.procs'
per-cgroup file, which enables atomic movement of multithreaded
applications between cgroups. Writing the thread-ID of any thread in a
threadgroup to a cgroup's procs file causes all threads in the group to
be moved to that cgroup safely with respect to threads forking/exiting.
(Possible usage scenario: If running a multithreaded build system that
sucks up system resources, this lets you restrict it all at once into a
new cgroup to keep it under control.)
Example: Suppose pid 31337 clones new threads 31338 and 31339.
# cat /dev/cgroup/tasks
...
31337
31338
31339
# mkdir /dev/cgroup/foo
# echo 31337 > /dev/cgroup/foo/cgroup.procs
# cat /dev/cgroup/foo/tasks
31337
31338
31339
A new lock, called threadgroup_fork_lock and living in signal_struct, is
introduced to ensure atomicity when moving threads between cgroups. It's
taken for writing during the operation, and taking for reading in fork()
around the calls to cgroup_fork() and cgroup_post_fork(). I put calls to
down_read/up_read directly in copy_process(), since new inline functions
seemed like overkill.
-- Ben
---
Documentation/cgroups/cgroups.txt | 13 -
include/linux/init_task.h | 9
include/linux/sched.h | 10
kernel/cgroup.c | 426 +++++++++++++++++++++++++++++++++-----
kernel/cgroup_freezer.c | 4
kernel/cpuset.c | 4
kernel/fork.c | 16 +
kernel/ns_cgroup.c | 4
kernel/sched.c | 4
9 files changed, 440 insertions(+), 50 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20100730235649.GA22644-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org>]
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
[not found] ` <20100730235649.GA22644-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org>
@ 2010-08-03 19:58 ` Andrew Morton
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2010-08-03 19:58 UTC (permalink / raw)
To: Ben Blum
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, oleg-H+wXaHxf7aLQT0dZR+AlfA,
menage-hpIqsD4AKlfQT0dZR+AlfA, ebiederm-aS9lmoZGLiVWk0Htik3J/w
On Fri, 30 Jul 2010 19:56:49 -0400
Ben Blum <bblum-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org> wrote:
> This patch series implements a write function for the 'cgroup.procs'
> per-cgroup file, which enables atomic movement of multithreaded
> applications between cgroups. Writing the thread-ID of any thread in a
> threadgroup to a cgroup's procs file causes all threads in the group to
> be moved to that cgroup safely with respect to threads forking/exiting.
> (Possible usage scenario: If running a multithreaded build system that
> sucks up system resources, this lets you restrict it all at once into a
> new cgroup to keep it under control.)
I can see how that would be useful. No comments from anyone else?
patch 1/2 makes me cry with all those ifdefs. Maybe helper functions
would help, but not a lot.
patch 2/2 looks very complicated.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
2010-07-30 23:56 Ben Blum
[not found] ` <20100730235649.GA22644-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org>
@ 2010-08-03 19:58 ` Andrew Morton
[not found] ` <20100803125827.0822e6ab.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2010-08-03 23:45 ` KAMEZAWA Hiroyuki
1 sibling, 2 replies; 8+ messages in thread
From: Andrew Morton @ 2010-08-03 19:58 UTC (permalink / raw)
To: Ben Blum; +Cc: linux-kernel, containers, ebiederm, lizf, matthltc, menage, oleg
On Fri, 30 Jul 2010 19:56:49 -0400
Ben Blum <bblum@andrew.cmu.edu> wrote:
> This patch series implements a write function for the 'cgroup.procs'
> per-cgroup file, which enables atomic movement of multithreaded
> applications between cgroups. Writing the thread-ID of any thread in a
> threadgroup to a cgroup's procs file causes all threads in the group to
> be moved to that cgroup safely with respect to threads forking/exiting.
> (Possible usage scenario: If running a multithreaded build system that
> sucks up system resources, this lets you restrict it all at once into a
> new cgroup to keep it under control.)
I can see how that would be useful. No comments from anyone else?
patch 1/2 makes me cry with all those ifdefs. Maybe helper functions
would help, but not a lot.
patch 2/2 looks very complicated.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20100803125827.0822e6ab.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>]
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
[not found] ` <20100803125827.0822e6ab.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2010-08-03 23:45 ` KAMEZAWA Hiroyuki
2010-08-04 2:00 ` Li Zefan
1 sibling, 0 replies; 8+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-08-03 23:45 UTC (permalink / raw)
To: Andrew Morton
Cc: Ben Blum, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, oleg-H+wXaHxf7aLQT0dZR+AlfA,
menage-hpIqsD4AKlfQT0dZR+AlfA, ebiederm-aS9lmoZGLiVWk0Htik3J/w
On Tue, 3 Aug 2010 12:58:27 -0700
Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> wrote:
> On Fri, 30 Jul 2010 19:56:49 -0400
> Ben Blum <bblum-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org> wrote:
>
> > This patch series implements a write function for the 'cgroup.procs'
> > per-cgroup file, which enables atomic movement of multithreaded
> > applications between cgroups. Writing the thread-ID of any thread in a
> > threadgroup to a cgroup's procs file causes all threads in the group to
> > be moved to that cgroup safely with respect to threads forking/exiting.
> > (Possible usage scenario: If running a multithreaded build system that
> > sucks up system resources, this lets you restrict it all at once into a
> > new cgroup to keep it under control.)
>
> I can see how that would be useful. No comments from anyone else?
>
I think the feature itself is good and useful. I welcome this.
> patch 1/2 makes me cry with all those ifdefs. Maybe helper functions
> would help, but not a lot.
>
Add static inline functions ?
> patch 2/2 looks very complicated.
yes. that's a concern.
I'd like to look deeper, today.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
2010-08-03 19:58 ` Andrew Morton
@ 2010-08-04 2:00 ` Li Zefan
2010-08-03 23:45 ` KAMEZAWA Hiroyuki
1 sibling, 0 replies; 8+ messages in thread
From: Li Zefan @ 2010-08-04 2:00 UTC (permalink / raw)
To: Andrew Morton
Cc: Ben Blum, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, oleg-H+wXaHxf7aLQT0dZR+AlfA,
menage-hpIqsD4AKlfQT0dZR+AlfA, ebiederm-aS9lmoZGLiVWk0Htik3J/w
Andrew Morton wrote:
> On Fri, 30 Jul 2010 19:56:49 -0400
> Ben Blum <bblum-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org> wrote:
>
>> This patch series implements a write function for the 'cgroup.procs'
>> per-cgroup file, which enables atomic movement of multithreaded
>> applications between cgroups. Writing the thread-ID of any thread in a
>> threadgroup to a cgroup's procs file causes all threads in the group to
>> be moved to that cgroup safely with respect to threads forking/exiting.
>> (Possible usage scenario: If running a multithreaded build system that
>> sucks up system resources, this lets you restrict it all at once into a
>> new cgroup to keep it under control.)
>
> I can see how that would be useful. No comments from anyone else?
>
Oleg had been commenting on this patchset, so it would be nice to know
if he's comfortable with the changes in this version.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
@ 2010-08-04 2:00 ` Li Zefan
0 siblings, 0 replies; 8+ messages in thread
From: Li Zefan @ 2010-08-04 2:00 UTC (permalink / raw)
To: Andrew Morton
Cc: Ben Blum, linux-kernel, containers, ebiederm, matthltc, menage, oleg
Andrew Morton wrote:
> On Fri, 30 Jul 2010 19:56:49 -0400
> Ben Blum <bblum@andrew.cmu.edu> wrote:
>
>> This patch series implements a write function for the 'cgroup.procs'
>> per-cgroup file, which enables atomic movement of multithreaded
>> applications between cgroups. Writing the thread-ID of any thread in a
>> threadgroup to a cgroup's procs file causes all threads in the group to
>> be moved to that cgroup safely with respect to threads forking/exiting.
>> (Possible usage scenario: If running a multithreaded build system that
>> sucks up system resources, this lets you restrict it all at once into a
>> new cgroup to keep it under control.)
>
> I can see how that would be useful. No comments from anyone else?
>
Oleg had been commenting on this patchset, so it would be nice to know
if he's comfortable with the changes in this version.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs
2010-08-03 19:58 ` Andrew Morton
[not found] ` <20100803125827.0822e6ab.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2010-08-03 23:45 ` KAMEZAWA Hiroyuki
1 sibling, 0 replies; 8+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-08-03 23:45 UTC (permalink / raw)
To: Andrew Morton
Cc: Ben Blum, linux-kernel, containers, ebiederm, lizf, matthltc,
menage, oleg
On Tue, 3 Aug 2010 12:58:27 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 30 Jul 2010 19:56:49 -0400
> Ben Blum <bblum@andrew.cmu.edu> wrote:
>
> > This patch series implements a write function for the 'cgroup.procs'
> > per-cgroup file, which enables atomic movement of multithreaded
> > applications between cgroups. Writing the thread-ID of any thread in a
> > threadgroup to a cgroup's procs file causes all threads in the group to
> > be moved to that cgroup safely with respect to threads forking/exiting.
> > (Possible usage scenario: If running a multithreaded build system that
> > sucks up system resources, this lets you restrict it all at once into a
> > new cgroup to keep it under control.)
>
> I can see how that would be useful. No comments from anyone else?
>
I think the feature itself is good and useful. I welcome this.
> patch 1/2 makes me cry with all those ifdefs. Maybe helper functions
> would help, but not a lot.
>
Add static inline functions ?
> patch 2/2 looks very complicated.
yes. that's a concern.
I'd like to look deeper, today.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-08-04 2:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30 23:56 [PATCH v4 0/2] cgroups: implement moving a threadgroup's threads atomically with cgroup.procs Ben Blum
2010-07-30 23:56 Ben Blum
[not found] ` <20100730235649.GA22644-dJQ2lsn+DImqwBT9kiuFm8WGCVk0P7UB@public.gmane.org>
2010-08-03 19:58 ` Andrew Morton
2010-08-03 19:58 ` Andrew Morton
[not found] ` <20100803125827.0822e6ab.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2010-08-03 23:45 ` KAMEZAWA Hiroyuki
2010-08-04 2:00 ` Li Zefan
2010-08-04 2:00 ` Li Zefan
2010-08-03 23:45 ` KAMEZAWA Hiroyuki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.