• Tejun Heo's avatar
    iocost: protect iocg->abs_vdebt with iocg->waitq.lock · 34ca0800
    Tejun Heo authored
    commit 0b80f986 upstream.
    
    abs_vdebt is an atomic_64 which tracks how much over budget a given cgroup
    is and controls the activation of use_delay mechanism. Once a cgroup goes
    over budget from forced IOs, it has to pay it back with its future budget.
    The progress guarantee on debt paying comes from the iocg being active -
    active iocgs are processed by the periodic timer, which ensures that as time
    passes the debts dissipate and the iocg returns to normal operation.
    
    However, both iocg activation and vdebt handling are asynchronous and a
    sequence like the following may happen.
    
    1. The iocg is in the process of being deactivated by the periodic timer.
    
    2. A bio enters ioc_rqos_throttle(), calls iocg_activate() which returns
       without anything because it still sees that the iocg is already active.
    
    3. The iocg is deactivated.
    
    4. The bio from #2 is over budget but needs to be forced. It increases
       abs_vdebt and goes over...
    34ca0800
blk-iocost.c 67.8 KB