* [RFC] cgroup basic comounting
@ 2011-12-16 12:29 Glauber Costa
[not found] ` <1324038549-21605-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Glauber Costa @ 2011-12-16 12:29 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: paul-inf54ven1CmVyaH7bEyXVA, lizf-BthXqXjhjHXQFUHtdCDX3A,
daniel.lezcano-GANU6spQydw, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw,
jbottomley-bzQdu9zFT3WakBO8gow8eQ, pjt-hpIqsD4AKlfQT0dZR+AlfA,
cgroups-u79uwXL29TY76Z2rM5mHXA,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w, devel-GEFAQzZX7r8dnm+yROfE0A,
kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A, Glauber Costa
Turns out that most of the infrastructure we need to put two controllers in the
same hierarchy is by far already into place. All we need to do is not failing
when we specify two of them.
With this, we can effectively guarantee that by comounting cpu and cpuacct,
we'll have the same set of tasks, therefore allowing us to use cpu cgroup data
to fill in the usage fields in cpuacct.
I decided not to stabilish any dependency between cgroups as Li previously did:
cgroups may or may not be comounted, and any of them can be combined (I don't
see a reason to prevent any combination).
After testing and some trials, I could verify that the current mount behavior
plays well under the plans, so I didn't change it. That is:
* If subsystems A and B aren't mounted, we can comount them.
* If subsystem A is mounted, but B is not:
* we can comount them if A has no children,
* we fail otherwise
* If subsystems A and B are comounted at a location, we can't
mount any of them separately at another point. We do can mount
them together.
* If subsystems A and B are comounted at a location,
* we can comount a third subsystem C, if they have no children
* we fail otherwise
Paul,
Please let me know if this is tuned with the idea you had in mind.
If this is okay, I patch that extracts usage from cpu cgroup data
in case of comount would follow.
Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
CC: Paul Turner <pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
CC: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
kernel/cgroup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 1fd7867..e894a4f 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1211,9 +1211,9 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
set_bit(i, &opts->subsys_bits);
one_ss = true;
- break;
+ continue;
}
- if (i == CGROUP_SUBSYS_COUNT)
+ if (opts->subsys_bits == 0)
return -ENOENT;
}
--
1.7.6.4
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1324038549-21605-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>]
* Re: [RFC] cgroup basic comounting [not found] ` <1324038549-21605-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> @ 2011-12-16 16:35 ` Paul Menage 2011-12-19 7:58 ` Li Zefan 1 sibling, 0 replies; 4+ messages in thread From: Paul Menage @ 2011-12-16 16:35 UTC (permalink / raw) To: Glauber Costa Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, lizf-BthXqXjhjHXQFUHtdCDX3A, daniel.lezcano-GANU6spQydw, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, jbottomley-bzQdu9zFT3WakBO8gow8eQ, pjt-hpIqsD4AKlfQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, bsingharora-Re5JQEeQqe8AvxtiuMwx3w, devel-GEFAQzZX7r8dnm+yROfE0A, kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A On Fri, Dec 16, 2011 at 4:29 AM, Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> wrote > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index 1fd7867..e894a4f 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -1211,9 +1211,9 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) > set_bit(i, &opts->subsys_bits); > one_ss = true; > > - break; > + continue; > } > - if (i == CGROUP_SUBSYS_COUNT) > + if (opts->subsys_bits == 0) > return -ENOENT; This is broken - it will silently ignore unknown/misspelled subsystems that are specified after a valid subsystem. Replacing the break with a continue is harmless but doesn't make sense - if the token already matched a subsystem name then it won't match any other subsystem. What change are you actually trying to effect with this patch? Paul -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] cgroup basic comounting [not found] ` <1324038549-21605-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> 2011-12-16 16:35 ` Paul Menage @ 2011-12-19 7:58 ` Li Zefan [not found] ` <4EEEEE9D.1010003-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: Li Zefan @ 2011-12-19 7:58 UTC (permalink / raw) To: Glauber Costa Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, paul-inf54ven1CmVyaH7bEyXVA, daniel.lezcano-GANU6spQydw, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, jbottomley-bzQdu9zFT3WakBO8gow8eQ, pjt-hpIqsD4AKlfQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, bsingharora-Re5JQEeQqe8AvxtiuMwx3w, devel-GEFAQzZX7r8dnm+yROfE0A, kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A Glauber Costa wrote: > Turns out that most of the infrastructure we need to put two controllers in the > same hierarchy is by far already into place. All we need to do is not failing > when we specify two of them. > You don't need to change anything to mount with 2 cgroup subsystems: # mount -t cgroup -o cpu,cpuacct xxx /mnt But you may want to revise and make use of the subsys->bind() callback, which is called at mount/remount/umount when we attach/remove a controller to/from a hierarchy. It's the place you can check if two controllers are going to be comounted/seperated. > With this, we can effectively guarantee that by comounting cpu and cpuacct, > we'll have the same set of tasks, therefore allowing us to use cpu cgroup data > to fill in the usage fields in cpuacct. > > I decided not to stabilish any dependency between cgroups as Li previously did: > cgroups may or may not be comounted, and any of them can be combined (I don't > see a reason to prevent any combination). > > After testing and some trials, I could verify that the current mount behavior > plays well under the plans, so I didn't change it. That is: > > * If subsystems A and B aren't mounted, we can comount them. > * If subsystem A is mounted, but B is not: > * we can comount them if A has no children, > * we fail otherwise > * If subsystems A and B are comounted at a location, we can't > mount any of them separately at another point. We do can mount > them together. > * If subsystems A and B are comounted at a location, > * we can comount a third subsystem C, if they have no children > * we fail otherwise > > Paul, > > Please let me know if this is tuned with the idea you had in mind. > If this is okay, I patch that extracts usage from cpu cgroup data > in case of comount would follow. > > Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> > CC: Paul Turner <pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> > CC: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> > --- > kernel/cgroup.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index 1fd7867..e894a4f 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -1211,9 +1211,9 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) > set_bit(i, &opts->subsys_bits); > one_ss = true; > > - break; > + continue; > } > - if (i == CGROUP_SUBSYS_COUNT) > + if (opts->subsys_bits == 0) > return -ENOENT; > } > ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <4EEEEE9D.1010003-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>]
* Re: [RFC] cgroup basic comounting [not found] ` <4EEEEE9D.1010003-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> @ 2011-12-19 8:00 ` Glauber Costa 0 siblings, 0 replies; 4+ messages in thread From: Glauber Costa @ 2011-12-19 8:00 UTC (permalink / raw) To: Li Zefan Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, paul-inf54ven1CmVyaH7bEyXVA, daniel.lezcano-GANU6spQydw, a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw, jbottomley-bzQdu9zFT3WakBO8gow8eQ, pjt-hpIqsD4AKlfQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, bsingharora-Re5JQEeQqe8AvxtiuMwx3w, devel-GEFAQzZX7r8dnm+yROfE0A, kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A On 12/19/2011 11:58 AM, Li Zefan wrote: > Glauber Costa wrote: >> Turns out that most of the infrastructure we need to put two controllers in the >> same hierarchy is by far already into place. All we need to do is not failing >> when we specify two of them. >> > > You don't need to change anything to mount with 2 cgroup subsystems: > > # mount -t cgroup -o cpu,cpuacct xxx /mnt > > But you may want to revise and make use of the subsys->bind() callback, which > is called at mount/remount/umount when we attach/remove a controller to/from > a hierarchy. It's the place you can check if two controllers are going to > be comounted/seperated. > >> With this, we can effectively guarantee that by comounting cpu and cpuacct, >> we'll have the same set of tasks, therefore allowing us to use cpu cgroup data >> to fill in the usage fields in cpuacct. Yeah, that patch was bogus, sorry for the noise. What I should really have posted is the test code, but I guess I'll go over that one as well one more time, and then post it. Thanks >> I decided not to stabilish any dependency between cgroups as Li previously did: >> cgroups may or may not be comounted, and any of them can be combined (I don't >> see a reason to prevent any combination). >> >> After testing and some trials, I could verify that the current mount behavior >> plays well under the plans, so I didn't change it. That is: >> >> * If subsystems A and B aren't mounted, we can comount them. >> * If subsystem A is mounted, but B is not: >> * we can comount them if A has no children, >> * we fail otherwise >> * If subsystems A and B are comounted at a location, we can't >> mount any of them separately at another point. We do can mount >> them together. >> * If subsystems A and B are comounted at a location, >> * we can comount a third subsystem C, if they have no children >> * we fail otherwise >> >> Paul, >> >> Please let me know if this is tuned with the idea you had in mind. >> If this is okay, I patch that extracts usage from cpu cgroup data >> in case of comount would follow. >> >> Signed-off-by: Glauber Costa<glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> >> CC: Paul Turner<pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> >> CC: Li Zefan<lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> >> --- >> kernel/cgroup.c | 4 ++-- >> 1 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/cgroup.c b/kernel/cgroup.c >> index 1fd7867..e894a4f 100644 >> --- a/kernel/cgroup.c >> +++ b/kernel/cgroup.c >> @@ -1211,9 +1211,9 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts) >> set_bit(i,&opts->subsys_bits); >> one_ss = true; >> >> - break; >> + continue; >> } >> - if (i == CGROUP_SUBSYS_COUNT) >> + if (opts->subsys_bits == 0) >> return -ENOENT; >> } >> > -- > To unsubscribe from this list: send the line "unsubscribe cgroups" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-19 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 12:29 [RFC] cgroup basic comounting Glauber Costa
[not found] ` <1324038549-21605-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2011-12-16 16:35 ` Paul Menage
2011-12-19 7:58 ` Li Zefan
[not found] ` <4EEEEE9D.1010003-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-12-19 8:00 ` Glauber Costa
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).