• Shaohua Li's avatar
    blk-throttle: add interface for per-cgroup target latency · ec80991d
    Shaohua Li authored
    Here we introduce per-cgroup latency target. The target determines how a
    cgroup can afford latency increasement. We will use the target latency
    to calculate a threshold and use it to schedule IO for cgroups. If a
    cgroup's bandwidth is below its low limit but its average latency is
    below the threshold, other cgroups can safely dispatch more IO even
    their bandwidth is higher than their low limits. On the other hand, if
    the first cgroup's latency is higher than the threshold, other cgroups
    are throttled to their low limits. So the target latency determines how
    we efficiently utilize free disk resource without sacifice of worload's
    IO latency.
    
    For example, assume 4k IO average latency is 50us when disk isn't
    congested. A cgroup sets the target latency to 30us. Then the cgroup can
    accept 50+30=80us IO latency. If the cgroupt's average IO latency is
    90us and its bandwidth is below low limit, other cgroups are throttled
    to their low limit. If the cgroup's average IO latency is 60us, other
    cgroups are allowed to dispatch more IO. When other cgroups dispatch
    more IO, the first cgroup's IO latency will increase. If it increases to
    81us, we then throttle other cgroups.
    
    User will configure the interface in this way:
    echo "8:16 rbps=2097152 wbps=max latency=100 idle=200" > io.low
    
    latency is in microsecond unit
    
    By default, latency target is 0, which means to guarantee IO latency.
    Signed-off-by: default avatarShaohua Li <shli@fb.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    ec80991d
blk-throttle.c 60.2 KB