]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Use cache when calling cgroup_change_cgroup_flags()
authorPeter Schiffer <pschiffe@redhat.com>
Mon, 14 Oct 2013 06:49:34 +0000 (08:49 +0200)
committerPeter Schiffer <pschiffe@redhat.com>
Mon, 14 Oct 2013 06:49:34 +0000 (08:49 +0200)
When system contains cgrules.conf file with few thousand rules,
cgroup_change_cgroup_flags() function without CGFLAG_USECACHE flag is very
slow.

As Ivana pointed out, cgexec and cgclassify tools might have problems with
cache
reloading, so I've removed them from the patch for now.

Currently, the patch affects only cgrulesengd daemon. Testing was done with
approximately 4000 users, rules in cgrules.conf file and same amount of
entries
in cgconfig.conf. Without the CGFLAG_USECACHE the cgrulesengd is starting
for
about 15 - 20 minutes (this is because of cgroup_change_all_cgroups()
function,
which scans all running processes on cgrulesengd start).

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
src/api.c

index 38314fbf1666a1d43dc552c61491c4f979430412..3fa604a2afe2d9e24866ae19d32112dab50d5b67 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -3125,7 +3125,8 @@ int cgroup_change_all_cgroups(void)
                if (err)
                        continue;
 
-               err = cgroup_change_cgroup_flags(euid, egid, procname, pid, 0);
+               err = cgroup_change_cgroup_flags(euid,
+                               egid, procname, pid, CGFLAG_USECACHE);
                if (err)
                        cgroup_dbg("cgroup change pid %i failed\n", pid);
        }