OSDN Git Service

blk-iolatency: Make initialization lazy
authorTejun Heo <tj@kernel.org>
Thu, 13 Apr 2023 00:06:49 +0000 (14:06 -1000)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Apr 2023 12:46:49 +0000 (06:46 -0600)
commita13696b83da4f1e53e192ec3e239afd3a96ff747
treea54ab31b1a940a496760bdc0c0c62b7394b0bf2e
parent3304918758125a0eb18fb480c82945e327b81f78
blk-iolatency: Make initialization lazy

Other rq_qos policies such as wbt and iocost are lazy-initialized when they
are configured for the first time for the device but iolatency is
initialized unconditionally from blkcg_init_disk() during gendisk init. Lazy
init is beneficial because rq_qos policies add runtime overhead when
initialized as every IO has to walk all registered rq_qos callbacks.

This patch switches iolatency to lazy initialization too so that it only
registered its rq_qos policy when it is first configured.

Note that there is a known race condition between blkcg config file writes
and del_gendisk() and this patch makes iolatency susceptible to it by
exposing the init path to race against the deletion path. However, that
problem already exists in iocost and is being worked on.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20230413000649.115785-5-tj@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c
block/blk-iolatency.c
block/blk.h