• Tejun Heo's avatar
    blk-iocost: restructure surplus donation logic · 93f7d2db
    Tejun Heo authored
    The way the surplus donation logic is structured isn't great. There are two
    separate paths for starting/increasing donations and decreasing them making
    the logic harder to follow and is prone to unnecessary behavior differences.
    
    In preparation for improved donation handling, this patch restructures the
    code so that
    
    * All donors - new, increasing and decreasing - are funneled through the
      same code path.
    
    * The target donation calculation is factored into hweight_after_donation()
      which is called once from the same spot for all possible donors.
    
    * Actual inuse adjustment is factored into trasnfer_surpluses().
    
    This change introduces a few behavior differences - e.g. donation amount
    reduction now uses the max usage of the recent three periods just like new
    and increasing donations, and inuse now gets adjusted upwards the same way
    it gets downwards. These differences are unlikely to have severely negative
    implications and the whole logic will be revamped soon.
    
    This patch also removes two tracepoints. The existing TPs don't quite fit
    the new implementation. A later patch will update and reinstate them.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    93f7d2db
blk-iocost.c 75.9 KB