Currently, libcgroup code reads /etc/passwd file once for every line in the cgrules.conf file, what can have performance impact on the login times if system contains thousands of users and cgrules.conf contains thousands of lines.
This patch adds CGFLAG_USECACHE flag to the cgroup_change_cgroup_uid_gid() function call which enables cache usage, and thus speeds up login times on those systems.
Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
/* Note: We are using default gid here. Is there a way to determine
* under what egid service will be provided?
*/
- ret = cgroup_change_cgroup_uid_gid(pwd->pw_uid, pwd->pw_gid, pid);
+ ret = cgroup_change_cgroup_uid_gid_flags(pwd->pw_uid,
+ pwd->pw_gid, pid, CGFLAG_USECACHE);
if (ret) {
if (ctrl & PAM_DEBUG_ARG)
pam_syslog(pamh, LOG_ERR, "Change of cgroup for process"