Re-instate cgroup names in /proc/sched_debug. Autogroup patch removed displaying the cgroup pathnames for per-CPU cfs_rqs and tasks in /proc/sched_debug. Re-instate this. Signed-off-by: Bharata B Rao Index: linux-2.6-tip/kernel/sched_debug.c =================================================================== --- linux-2.6-tip.orig/kernel/sched_debug.c 2010-12-11 01:25:58.000000000 +0530 +++ linux-2.6-tip/kernel/sched_debug.c 2010-12-21 02:23:05.000000000 +0530 @@ -86,6 +86,25 @@ } #endif +#if defined(CONFIG_CGROUP_SCHED) && \ + (defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)) +/* + * This is essentially same as sched.c:task_group except + * that it doesn't bother about autogroups. Essentially + * this is how task_group() looked like before autogroup + * changes. + * Named task_sched_group() for want of a better name. + */ +static struct task_group *task_sched_group(struct task_struct *p) +{ + struct cgroup_subsys_state *css; + + css = task_subsys_state_check(p, cpu_cgroup_subsys_id, + lockdep_is_held(&task_rq(p)->lock)); + return container_of(css, struct task_group, css); +} +#endif + static void print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) { @@ -108,6 +127,16 @@ SEQ_printf(m, "%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld", 0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L); #endif +#ifdef CONFIG_CGROUP_SCHED + { + char path[64]; + + rcu_read_lock(); + cgroup_path(task_sched_group(p)->css.cgroup, path, sizeof(path)); + rcu_read_unlock(); + SEQ_printf(m, " %s", path); + } +#endif SEQ_printf(m, "\n"); } @@ -136,6 +165,19 @@ read_unlock_irqrestore(&tasklist_lock, flags); } +#if defined(CONFIG_CGROUP_SCHED) && \ + (defined(CONFIG_FAIR_GROUP_SCHED) || defined(CONFIG_RT_GROUP_SCHED)) +static void task_group_path(struct task_group *tg, char *buf, int buflen) +{ + /* may be NULL if the underlying cgroup isn't fully-created yet */ + if (!tg->css.cgroup) { + buf[0] = '\0'; + return; + } + cgroup_path(tg->css.cgroup, buf, buflen); +} +#endif + void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) { s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1, @@ -144,7 +186,16 @@ struct sched_entity *last; unsigned long flags; +#if defined(CONFIG_CGROUP_SCHED) && defined(CONFIG_FAIR_GROUP_SCHED) + char path[128]; + struct task_group *tg = cfs_rq->tg; + + task_group_path(tg, path, sizeof(path)); + + SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, path); +#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));