• Tejun Heo's avatar
    blk-iolatency: Make initialization lazy · a13696b8
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Cc: Josef Bacik <josef@toxicpanda.com>
    Link: https://lore.kernel.org/r/20230413000649.115785-5-tj@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    a13696b8
blk-cgroup.c 54.6 KB