Re: [PATCH 1/2] sched/fair: Use task_groups instead of leaf_cfs_rq_list to walk all cfs_rqs

From: Tejun Heo
Date: Thu May 04 2017 - 13:32:02 EST

Hello, Peter.

On Thu, May 04, 2017 at 03:31:22PM +0200, Peter Zijlstra wrote:
> Yes we can hit an (almost) dead cfs_rq, but poking the bandwidth
> variables thereof is harmless.
> unthrottle_cfs_rq() also stops doing anything much when it finds the
> cfs_rq is empty, which must be the case if we're removing it.

Yeah, if you're okay with calling the functions on dead cfs_rq's, just
wrapping with rcu_read_lock should be enough.

> I don't know Paul's opinion on RCU GPs happening while stop_machine(),
> but just in case he feels that's fair game, I did add the
> rcu_read_lock() thingies.
> The lockdep assert is mostly documentation, to more easily see
> it is indeed held when we get there.
> I left print_cfs_stats using the leaf list, no point in printing stuff
> that's empty.
> This way we can avoid taking all RQ locks on cgroup destruction.

Looks good to me.