Commit 6c415b9234a8c71f290e5d4fddc467f103f32719

Authored by Arun R Bharadwaj
Committed by Ingo Molnar
1 parent 70574a996f

sched: add uid information to sched_debug for CONFIG_USER_SCHED

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>

Showing 4 changed files with 18 additions and 1 deletions Side-by-side Diff

include/linux/sched.h
... ... @@ -2218,6 +2218,7 @@
2218 2218 extern struct task_group init_task_group;
2219 2219 #ifdef CONFIG_USER_SCHED
2220 2220 extern struct task_group root_task_group;
  2221 +extern void set_tg_uid(struct user_struct *user);
2221 2222 #endif
2222 2223  
2223 2224 extern struct task_group *sched_create_group(struct task_group *parent);
... ... @@ -261,6 +261,10 @@
261 261 struct cgroup_subsys_state css;
262 262 #endif
263 263  
  264 +#ifdef CONFIG_USER_SCHED
  265 + uid_t uid;
  266 +#endif
  267 +
264 268 #ifdef CONFIG_FAIR_GROUP_SCHED
265 269 /* schedulable entities of this group on each cpu */
266 270 struct sched_entity **se;
... ... @@ -285,6 +289,12 @@
285 289 };
286 290  
287 291 #ifdef CONFIG_USER_SCHED
  292 +
  293 +/* Helper function to pass uid information to create_sched_user() */
  294 +void set_tg_uid(struct user_struct *user)
  295 +{
  296 + user->tg->uid = user->uid;
  297 +}
288 298  
289 299 /*
290 300 * Root task group.
kernel/sched_debug.c
... ... @@ -160,10 +160,14 @@
160 160 cgroup_path(tg->css.cgroup, path, sizeof(path));
161 161  
162 162 SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path);
  163 +#elif defined(CONFIG_USER_SCHED) && defined(CONFIG_FAIR_GROUP_SCHED)
  164 + {
  165 + uid_t uid = cfs_rq->tg->uid;
  166 + SEQ_printf(m, "\ncfs_rq[%d] for UID: %u\n", cpu, uid);
  167 + }
163 168 #else
164 169 SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
165 170 #endif
166   -
167 171 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock",
168 172 SPLIT_NS(cfs_rq->exec_clock));
169 173  
... ... @@ -101,6 +101,8 @@
101 101 if (IS_ERR(up->tg))
102 102 rc = -ENOMEM;
103 103  
  104 + set_tg_uid(up);
  105 +
104 106 return rc;
105 107 }
106 108