From: Peter Schiffer Date: Mon, 14 Oct 2013 06:49:34 +0000 (+0200) Subject: Use cache when calling cgroup_change_cgroup_flags() X-Git-Tag: v0.41~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a5be0d9530a81c386ddd3ddaa264d3e04e6b1fd;p=thirdparty%2Flibcgroup.git Use cache when calling cgroup_change_cgroup_flags() 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 Acked-by: Ivana Hutarova Varekova --- diff --git a/src/api.c b/src/api.c index 38314fbf..3fa604a2 100644 --- 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); }