• Jan Kara's avatar
    bfq: Limit number of requests consumed by each cgroup · 76f1df88
    Jan Kara authored
    When cgroup IO scheduling is used with BFQ it does not really provide
    service differentiation if the cgroup drives a big IO depth. That for
    example happens with writeback which asynchronously submits lots of IO
    but it can happen with AIO as well. The problem is that if we have two
    cgroups that submit IO with different weights, the cgroup with higher
    weight properly gets more IO time and is able to dispatch more IO.
    However this causes lower weight cgroup to accumulate more requests
    inside BFQ and eventually lower weight cgroup consumes most of IO
    scheduler tags. At that point higher weight cgroup stops getting better
    service as it is mostly blocked waiting for a scheduler tag while its
    queues inside BFQ are empty and thus lower weight cgroup gets served.
    
    Check how many requests submitting cgroup has allocated in
    bfq_limit_depth() and if it consumes more requests than what would
    correspond to its weight limit available depth to 1 so that the cgroup
    cannot consume many more requests. With this limitation the higher
    weight cgroup gets proper service even with writeback.
    Reviewed-by: default avatarMichal Koutný <mkoutny@suse.com>
    Acked-by: default avatarPaolo Valente <paolo.valente@linaro.org>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20211125133645.27483-4-jack@suse.czSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    76f1df88
bfq-iosched.c 259 KB