]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
Allow cgroup_config_table to be dynamically handled
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Fri, 30 Apr 2010 17:23:18 +0000 (22:53 +0530)
committerDhaval Giani <dhaval.giani@gmail.com>
Thu, 6 May 2010 15:44:55 +0000 (17:44 +0200)
commitaac069770a755d835e6a1ed2d85ec2fc6f56c7ef
treea7b26cd93c807208bf762698092918246122d294
parent04dbc8d432bc7404e62a1cf7a4eafad629dfd999
Allow cgroup_config_table to be dynamically handled

Allow cgconfigparser to create groups > MAX_GROUPS

From: Balbir Singh <balbir@linux.vnet.ibm.com>

Rafael Tinoco <rafael.tinoco@locaweb.com.br> noticed that the maximum
number of cgroups created using cgconfigparser fell short of 2000. Balbir
found a limitation in the code, that limited this number to a predefined
maximum. This patch fixes the limitation, although not in the most
optimized way, since we want to avoid double parsing of the configuraiton
file.

This patch realloc's the data structure that holds parsed cgroups.

Tested via setting MAX_CGROUPS=1 and loading a configuration file with
2 groups defined. Also tested with a large cgroup file

Test results after loading large_cgconfig.conf (generated using a
script). The size is large, but I wanted to send out the test case
since it adds to our regression bucket.

#subsys_name    hierarchy       num_cgroups     enabled
cpuset  0       1       1
ns      0       1       1
cpu     1       2021    1
cpuacct 1       2021    1
memory  2       2021    1
devices 0       1       1
freezer 0       1       1
net_cls 0       1       1

NOTE: Be careful, such a large number of groups could slow
down your system. This needs further investigation at the cgroups
layer in the kernel.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
samples/large_cgconfig.conf [new file with mode: 0644]
src/config.c
src/parse.y