diff options
-rw-r--r-- | include/linux/sched.h | 1 | ||||
-rw-r--r-- | kernel/sched.c | 10 | ||||
-rw-r--r-- | kernel/sched_debug.c | 6 | ||||
-rw-r--r-- | kernel/user.c | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 7a69c4d224ee..d8733f07d80b 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2218,6 +2218,7 @@ extern void normalize_rt_tasks(void); | |||
2218 | extern struct task_group init_task_group; | 2218 | extern struct task_group init_task_group; |
2219 | #ifdef CONFIG_USER_SCHED | 2219 | #ifdef CONFIG_USER_SCHED |
2220 | extern struct task_group root_task_group; | 2220 | extern struct task_group root_task_group; |
2221 | extern void set_tg_uid(struct user_struct *user); | ||
2221 | #endif | 2222 | #endif |
2222 | 2223 | ||
2223 | extern struct task_group *sched_create_group(struct task_group *parent); | 2224 | extern struct task_group *sched_create_group(struct task_group *parent); |
diff --git a/kernel/sched.c b/kernel/sched.c index 6a99703e0eb0..4c7388ef5be7 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -261,6 +261,10 @@ struct task_group { | |||
261 | struct cgroup_subsys_state css; | 261 | struct cgroup_subsys_state css; |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | #ifdef CONFIG_USER_SCHED | ||
265 | uid_t uid; | ||
266 | #endif | ||
267 | |||
264 | #ifdef CONFIG_FAIR_GROUP_SCHED | 268 | #ifdef CONFIG_FAIR_GROUP_SCHED |
265 | /* schedulable entities of this group on each cpu */ | 269 | /* schedulable entities of this group on each cpu */ |
266 | struct sched_entity **se; | 270 | struct sched_entity **se; |
@@ -286,6 +290,12 @@ struct task_group { | |||
286 | 290 | ||
287 | #ifdef CONFIG_USER_SCHED | 291 | #ifdef CONFIG_USER_SCHED |
288 | 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 | } | ||
298 | |||
289 | /* | 299 | /* |
290 | * Root task group. | 300 | * Root task group. |
291 | * Every UID task group (including init_task_group aka UID-0) will | 301 | * Every UID task group (including init_task_group aka UID-0) will |
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index baf2f17af462..4293cfa9681d 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -160,10 +160,14 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
160 | cgroup_path(tg->css.cgroup, path, sizeof(path)); | 160 | cgroup_path(tg->css.cgroup, path, sizeof(path)); |
161 | 161 | ||
162 | SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path); | 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 | #else | 168 | #else |
164 | SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu); | 169 | SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu); |
165 | #endif | 170 | #endif |
166 | |||
167 | SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock", | 171 | SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock", |
168 | SPLIT_NS(cfs_rq->exec_clock)); | 172 | SPLIT_NS(cfs_rq->exec_clock)); |
169 | 173 | ||
diff --git a/kernel/user.c b/kernel/user.c index 39d6159fae43..cec2224bc9f5 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -101,6 +101,8 @@ static int sched_create_user(struct user_struct *up) | |||
101 | if (IS_ERR(up->tg)) | 101 | if (IS_ERR(up->tg)) |
102 | rc = -ENOMEM; | 102 | rc = -ENOMEM; |
103 | 103 | ||
104 | set_tg_uid(up); | ||
105 | |||
104 | return rc; | 106 | return rc; |
105 | } | 107 | } |
106 | 108 | ||