From b46cfdb6c94ea5f5f443862b45e81b20057d013b Mon Sep 17 00:00:00 2001 From: Evgeniy Kochetov Date: Tue, 19 Jul 2022 10:58:49 +0300 Subject: [PATCH] bdev/qos: Process whole QoS queue on every Qos poll We have to process whole QoS queue on each QoS poll. It may contain IOs that still have quota or not affected by QoS rules at all. If we stop on the first queued IO, all IOs will be limited by the minimum QoS rule even if they're not affected by this rule. Here is an example and simple test. We have a NVMf target with Null bdev and QoS configured with read bandwidth limited to 10 MB/s and write bandwidth limited to 100 MB/s. First we start nvme_perf with only write IOs and we see that reported bandwidth is 100 MB/s. Then we start another instance of nvme_perf with only read IOs. We see that reported read bandwidth is 10 MB/s but we also see that write bandwidth also drops to 10 MB/s. Signed-off-by: Evgeniy Kochetov Change-Id: I1edf09d038e65f873deef19ecb0f4bf9725a5ca5 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13767 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk Reviewed-by: Konrad Sztyber --- lib/bdev/bdev.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 86af4d1ed..c0449b680 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -2199,13 +2199,11 @@ bdev_qos_io_submit(struct spdk_bdev_channel *ch, struct spdk_bdev_qos *qos) int submitted_ios = 0; TAILQ_FOREACH_SAFE(bdev_io, &qos->queued, internal.link, tmp) { - if (bdev_qos_queue_io(qos, bdev_io)) { - return submitted_ios; + if (!bdev_qos_queue_io(qos, bdev_io)) { + TAILQ_REMOVE(&qos->queued, bdev_io, internal.link); + bdev_io_do_submit(ch, bdev_io); + submitted_ios++; } - - TAILQ_REMOVE(&qos->queued, bdev_io, internal.link); - bdev_io_do_submit(ch, bdev_io); - submitted_ios++; } return submitted_ios;