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 <pschi...@redhat.com>
---
 src/pam/pam_cgroup.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/pam/pam_cgroup.c b/src/pam/pam_cgroup.c
index c4ce633..1d78b81 100644
--- a/src/pam/pam_cgroup.c
+++ b/src/pam/pam_cgroup.c
@@ -137,7 +137,8 @@ PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int 
flags,
        /* 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"


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to