On Thu, Jun 03, 2010 at 02:28:42PM +0200, Dhaval Giani wrote: > Hi Thomas, > > On Wed, Jun 2, 2010 at 5:57 PM, Thomas Liu <[email protected]> wrote: > > Hi there, > > > > I was wondering if it was possible to have subgroups within a cgroup that > > are also constrained by the cgroup. For instance, if I have > > > > group1 limited to 50% CPU and a subgroup of group1, group2, which is also > > limited to 50% CPU, I would like to have processes in group2 only be able > > to use 50% of the 50% that group1 is allowed. > > > > I tried doing this by creating a hierarchy of cgroups but it didn't seem to > > work. Is there any possible way to do this with cgroups? > > > > At this point in time, no. The current cpu scheduler is work > conserving. What that means is that if we can run a task, we run it, > and do not idle the system forcefully. > > Even with the rt group scheduler, all that happens is that you are > limited to a certain bandwidth every period. So at this point in time, > you cannot use 50% of 50% of a cpu. > > I am not sure how bharata's cfs hard limits patches handle this case > (ability to give 50% of the bandwidth of a group as opposed to 50% of > the bandwidth of CPU). Maybe he might know better!
As Dhaval mentioned, limiting of CPU bandwidth isn't yet supported for normal (non-rt) tasks. We are still working on it. With the new hard limits patches (aka cfs bandwidth control) (http://lkml.org/lkml/2010/4/28/88), it becomes possible to specify limits in units equivalent to number/percentage of CPUs. Say group1 needs to be limited to 50% of the CPU. Assuming that we are on dual CPU system, we could specify the quota and period as 0.5s and 1s respectively. With this bandwidth specification, group1 can get 0.5s max runtime every 1s which is equal to 1CPU in a dual CPU system and hence 50% of the available CPU bandwidth. Now if group2 needs to be limited to 50% of group1's limit, it means that group2 should be limited to 50% of 0.5s which is 0.25s every 1s. So you could specify the quota and period as 0.25s and 1s respectively which will ensure that group2 will get 25% of the overall CPU bandwidth, which is equal to 50% of group1's bandwidth. Does this make sense ? Regards, Bharata. ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
