sched: add uid information to sched_debug for CONFIG_USER_SCHED
authorArun R Bharadwaj <arun@linux.vnet.ibm.com>
Mon, 1 Dec 2008 15:19:05 +0000 (20:49 +0530)
committerIngo Molnar <mingo@elte.hu>
Mon, 1 Dec 2008 19:39:50 +0000 (20:39 +0100)
Impact: extend information in /proc/sched_debug

This patch adds uid information in sched_debug for CONFIG_USER_SCHED

Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/sched.h
kernel/sched.c
kernel/sched_debug.c
kernel/user.c

index 7a69c4d224eeda367c2f8c29311d20b56b13f34f..d8733f07d80bdc80a3caf2f7c4f5123afc317c50 100644 (file)
@@ -2218,6 +2218,7 @@ extern void normalize_rt_tasks(void);
 extern struct task_group init_task_group;
 #ifdef CONFIG_USER_SCHED
 extern struct task_group root_task_group;
+extern void set_tg_uid(struct user_struct *user);
 #endif
 
 extern struct task_group *sched_create_group(struct task_group *parent);
index 6a99703e0eb080fff32133556939867ace6016c2..4c7388ef5be7c5c4a601a91d295f0bb55d13e350 100644 (file)
@@ -261,6 +261,10 @@ struct task_group {
        struct cgroup_subsys_state css;
 #endif
 
+#ifdef CONFIG_USER_SCHED
+       uid_t uid;
+#endif
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
        /* schedulable entities of this group on each cpu */
        struct sched_entity **se;
@@ -286,6 +290,12 @@ struct task_group {
 
 #ifdef CONFIG_USER_SCHED
 
+/* Helper function to pass uid information to create_sched_user() */
+void set_tg_uid(struct user_struct *user)
+{
+       user->tg->uid = user->uid;
+}
+
 /*
  * Root task group.
  *     Every UID task group (including init_task_group aka UID-0) will
index baf2f17af4621737cb1b76daeb6023f30dbfde10..4293cfa9681d743f67a08298c5e3fccf7ae7b496 100644 (file)
@@ -160,10 +160,14 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
        cgroup_path(tg->css.cgroup, path, sizeof(path));
 
        SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path);
+#elif defined(CONFIG_USER_SCHED) && defined(CONFIG_FAIR_GROUP_SCHED)
+       {
+               uid_t uid = cfs_rq->tg->uid;
+               SEQ_printf(m, "\ncfs_rq[%d] for UID: %u\n", cpu, uid);
+       }
 #else
        SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
 #endif
-
        SEQ_printf(m, "  .%-30s: %Ld.%06ld\n", "exec_clock",
                        SPLIT_NS(cfs_rq->exec_clock));
 
index 39d6159fae430cf60811839f4e2dbd20aadb9e4a..cec2224bc9f5249293c4b2a15a2ad27416c45735 100644 (file)
@@ -101,6 +101,8 @@ static int sched_create_user(struct user_struct *up)
        if (IS_ERR(up->tg))
                rc = -ENOMEM;
 
+       set_tg_uid(up);
+
        return rc;
 }