• Tejun Heo's avatar
    blk-iocost: grab ioc->lock for debt handling · da437b95
    Tejun Heo authored
    
    
    Currently, debt handling requires only iocg->waitq.lock. In the future, we
    want to adjust and propagate inuse changes depending on debt status. Let's
    grab ioc->lock in debt handling paths in preparation.
    
    * Because ioc->lock nests outside iocg->waitq.lock, the decision to grab
      ioc->lock needs to be made before entering the critical sections.
    
    * Add and use iocg_[un]lock() which handles the conditional double locking.
    
    * Add @pay_debt to iocg_kick_waitq() so that debt payment happens only when
      the caller grabbed both locks.
    
    This patch is prepatory and the comments contain references to future
    changes.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    da437b95
blk-iocost.c 71.1 KB