On Thu, 2018-08-09 at 12:56 -0700, Tejun Heo wrote: +AD4- Hello, +AD4- +AD4- On Thu, Aug 09, 2018 at 07:53:36AM -0700, Bart Van Assche wrote: +AD4- +AD4- +-/+ACoAKg- +AD4- +AD4- +- +ACo- blkg+AF8-lookup - look up blkg for the specified request queue +AD4- +AD4- +- +ACo- +AEA-q: request+AF8-queue of interest +AD4- +AD4- +- +ACo- +AD4- +AD4- +- +ACo- Lookup blkg for +AEA-q at the root level. See also blkg+AF8-lookup(). +AD4- +AD4- +- +ACo-/ +AD4- +AD4- +-static inline struct blkcg+AF8-gq +ACo-blkg+AF8-root+AF8-lookup(struct request+AF8-queue +ACo-q) +AD4- +AD4- +-+AHs- +AD4- +AD4- +- struct blkcg+AF8-gq +ACo-blkg+ADs- +AD4- +AD4- +- +AD4- +AD4- +- rcu+AF8-read+AF8-lock()+ADs- +AD4- +AD4- +- blkg +AD0- blkg+AF8-lookup(+ACY-blkcg+AF8-root, q)+ADs- +AD4- +AD4- +- rcu+AF8-read+AF8-unlock()+ADs- +AD4- +AD4- +- +AD4- +AD4- +- return blkg+ADs- +AD4- +AD4- +-+AH0- +AD4- +AD4- So, root blkg is always available as long as the request+AF8-queue is +AD4- alive. Sth like the following would be simpler? +AD4- +AD4- static inline struct blkcg+AF8-gq +ACo-blk+AF8-queue+AF8-root+AF8-blkg(struct request+AF8-queue +ACo-q) +AD4- +AHs- +AD4- return q-+AD4-root+AF8-blkg+ADs- +AD4- +AH0- That would not only be simpler, it would also avoid that blk+AF8-queue+AF8-root+AF8-blkg() returns NULL if bypass mode is enabled and the request queue is still associated with the block cgroup controller. How do you want to proceed with this change? Bart.