]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - block/blk-cgroup.c
blkcg: always create the blkcg_gq for the root blkcg
authorTejun Heo <tj@kernel.org>
Fri, 22 May 2015 21:13:19 +0000 (17:13 -0400)
committerJens Axboe <axboe@fb.com>
Tue, 2 Jun 2015 14:33:33 +0000 (08:33 -0600)
commitec13b1d6f0a0457312e615335ce8ceb07da50a11
treea14e8de732d5925ee847180559eb42b83f79ac34
parentefa7d1c733d1d2c1a468b85126d70bad9fdf6ba8
blkcg: always create the blkcg_gq for the root blkcg

Currently, blkcg does a minor optimization where the root blkcg is
created when the first blkcg policy is activated on a queue and
destroyed on the deactivation of the last.  On systems where blkcg is
configured but not used, this saves one blkcg_gq struct per queue.  On
systems where blkcg is actually used, there's no difference.  The only
case where this can lead to any meaninful, albeit still minute, save
in memory consumption is when all blkcg policies are deactivated after
being widely used in the system, which is a hihgly unlikely scenario.

The conditional existence of root blkcg_gq has already created several
bugs in blkcg and became an issue once again for the new per-cgroup
wb_congested mechanism for cgroup writeback support leading to a NULL
dereference when no blkcg policy is active.  This is really not worth
bothering with.  This patch makes blkcg always allocate and link the
root blkcg_gq and release it only on queue destruction.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-cgroup.c