Re: [PATCH 2/2] cgroup: Walk task list under tasklist_lock incgroup_enable_task_cg_list

From: Tejun Heo
Date: Tue Feb 21 2012 - 20:00:19 EST


On Wed, Feb 22, 2012 at 01:55:28AM +0100, Frederic Weisbecker wrote:
> > > + * We need tasklist_lock because RCU is not safe against
> > > + * while_each_thread(). Besides, a forking task that has passed
> > > + * cgroup_post_fork() without seeing use_task_css_set_links = 1
> > > + * is not guaranteed to have its child immediately visible in the
> > > + * tasklist if we walk through it with RCU.
> > > + */
> >
> > Maybe add TODO to remove the lock once do_each_thread()/while_each_thread()
> > is made rcu safe. On a large system, it could take a while to iterate
> > over every thread in the system. Thats a long time to hold a spinlock.
> > But it only happens once so probably not that big a deal.
>
> I think that even if while_each_thread() was RCU safe, that wouldn't
> work here.

Guys, this is one time thing. It happens *once* after boot and we're
already holding exclusive lock. There's no reason to optimize this at
all. Let's just keep it simple.

Thanks.

--
tejun
--
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/