• Tejun Heo's avatar
    blk-iocost: revamp in-period donation snapbacks · b0853ab4
    Tejun Heo authored
    When the margin drops below the minimum on a donating iocg, donation is
    immediately canceled in full. There are a couple shortcomings with the
    current behavior.
    
    * It's abrupt. A small temporary budget deficit can lead to a wide swing in
      weight allocation and a large surplus.
    
    * It's open coded in the issue path but not implemented for the merge path.
      A series of merges at a low inuse can make the iocg incur debts and stall
      incorrectly.
    
    This patch reimplements in-period donation snapbacks so that
    
    * inuse adjustment and cost calculations are factored into
      adjust_inuse_and_calc_cost() which is called from both the issue and merge
      paths.
    
    * Snapbacks are more gradual. It occurs in quarter steps.
    
    * A snapback triggers if the margin goes below the low threshold and is
      lower than the budget at the time of the last adjustment.
    
    * For the above, __propagate_weights() stores the margin in
      iocg->saved_margin. Move iocg->last_inuse storing together into
      __propagate_weights() for consistency.
    
    * Full snapback is guaranteed when there are waiters.
    
    * With precise donation and gradual snapbacks, inuse adjustments are now a
      lot more effective and the value of scaling inuse on weight changes isn't
      clear. Removed inuse scaling from weight_update().
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    b0853ab4
blk-iocost.c 85.2 KB