Re: [PATCH -tip 2/2] sched: Display autogroup names in/proc/sched_debug.

From: Bharata B Rao
Date: Mon Jan 10 2011 - 05:09:33 EST


On Mon, Jan 10, 2011 at 10:38:07AM +0100, Mike Galbraith wrote:
> On Mon, 2011-01-10 at 10:46 +0530, Bharata B Rao wrote:
> > sched: Display autogroup names in /proc/sched_debug.
> >
> > Add autogroup name to cfs_rq and tasks information in /proc/sched_debug.
> >
> > Signed-off-by: Bharata B Rao <bharata@xxxxxxxxxxxxxxxxxx>
> > ---
> > kernel/sched_debug.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > --- a/kernel/sched_debug.c
> > +++ b/kernel/sched_debug.c
> > @@ -92,6 +92,14 @@ static void print_cfs_group_stats(struct
> > #ifdef CONFIG_CGROUP_SCHED
> > static char * task_group_path(struct task_group *tg)
> > {
> > +#ifdef CONFIG_SCHED_AUTOGROUP
> > + int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled);
> > +
> > + if (enabled && tg->autogroup) {
> > + autogroup_path(tg, group_path, PATH_MAX);
> > + return group_path;
> > + }
> > +#endif
> > /*
> > * May be NULL if the underlying cgroup isn't fully-created yet
> > */
>
> What prevents the task being moved, and the task group being freed under
> you? Looks to me like task_group_path() needs rcu_read_lock(). It is
> locked in the other two instances. How about the below?

You are right, we need rcu_read_lock() there. Let me spin out an other
version with the changes.

Thanks,
Bharata.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/