When system contains cgrules.conf file with few thousand rules, cgroup_change_cgroup_flags() function without CGFLAG_USECACHE flag is very slow.
Signed-off-by: Peter Schiffer <pschi...@redhat.com> --- src/api.c | 6 ++++-- src/tools/cgclassify.c | 3 ++- src/tools/cgexec.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/api.c b/src/api.c index 183f387..5fef990 100644 --- a/src/api.c +++ b/src/api.c @@ -3052,7 +3052,8 @@ int cgroup_change_cgroup_uid_gid_flags(uid_t uid, gid_t gid, */ int cgroup_change_cgroup_uid_gid(uid_t uid, gid_t gid, pid_t pid) { - return cgroup_change_cgroup_uid_gid_flags(uid, gid, pid, 0); + return cgroup_change_cgroup_uid_gid_flags(uid, + gid, pid, CGFLAG_USECACHE); } /** @@ -3123,7 +3124,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); } diff --git a/src/tools/cgclassify.c b/src/tools/cgclassify.c index cae59b2..17f16ec 100644 --- a/src/tools/cgclassify.c +++ b/src/tools/cgclassify.c @@ -99,7 +99,8 @@ static int change_group_based_on_rule(pid_t pid) } /* Change the cgroup by determining the rules */ - ret = cgroup_change_cgroup_flags(euid, egid, procname, pid, 0); + ret = cgroup_change_cgroup_flags(euid, + egid, procname, pid, CGFLAG_USECACHE); if (ret) { fprintf(stderr, "Error: change of cgroup failed for" " pid %d: %s\n", pid, cgroup_strerror(ret)); diff --git a/src/tools/cgexec.c b/src/tools/cgexec.c index fa1c58c..daab51c 100644 --- a/src/tools/cgexec.c +++ b/src/tools/cgexec.c @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) /* Change the cgroup by determining the rules based on uid */ ret = cgroup_change_cgroup_flags(uid, gid, - argv[optind], pid, 0); + argv[optind], pid, CGFLAG_USECACHE); if (ret) { fprintf(stderr, "cgroup change of group failed\n"); return ret; ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel