linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Valente <paolo.valente@linaro.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	arie.vanderhoeven@seagate.com, rory.c.chen@seagate.com,
	Davide Zini <davidezini2@gmail.com>,
	Paolo Valente <paolo.valente@linaro.org>
Subject: [PATCH V6 8/8] block, bfq: balance I/O injection among underutilized actuators
Date: Thu,  3 Nov 2022 17:26:23 +0100	[thread overview]
Message-ID: <20221103162623.10286-9-paolo.valente@linaro.org> (raw)
In-Reply-To: <20221103162623.10286-1-paolo.valente@linaro.org>

From: Davide Zini <davidezini2@gmail.com>

Upon the invocation of its dispatch function, BFQ returns the next I/O
request of the in-service bfq_queue, unless some exception holds. One
such exception is that there is some underutilized actuator, different
from the actuator for which the in-service queue contains I/O, and
that some other bfq_queue happens to contain I/O for such an
actuator. In this case, the next I/O request of the latter bfq_queue,
and not of the in-service bfq_queue, is returned (I/O is injected from
that bfq_queue). To find such an actuator, a linear scan, in
increasing index order, is performed among actuators.

Performing a linear scan entails a prioritization among actuators: an
underutilized actuator may be considered for injection only if all
actuators with a lower index are currently fully utilized, or if there
is no pending I/O for any lower-index actuator that happens to be
underutilized.

This commits breaks this prioritization and tends to distribute
injection uniformly across actuators. This is obtained by adding the
following condition to the linear scan: even if an actuator A is
underutilized, A is however skipped if its load is higher than that of
the next actuator.

Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Davide Zini <davidezini2@gmail.com>
---
 block/bfq-iosched.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index db91f1a651d3..c568a5a112a7 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4813,10 +4813,16 @@ bfq_find_active_bfqq_for_actuator(struct bfq_data *bfqd,
 
 /*
  * Perform a linear scan of each actuator, until an actuator is found
- * for which the following two conditions hold: the load of the
- * actuator is below the threshold (see comments on actuator_load_threshold
- * for details), and there is a queue that contains I/O for that
- * actuator. On success, return that queue.
+ * for which the following three conditions hold: the load of the
+ * actuator is below the threshold (see comments on
+ * actuator_load_threshold for details) and lower than that of the
+ * next actuator (comments on this extra condition below), and there
+ * is a queue that contains I/O for that actuator. On success, return
+ * that queue.
+ *
+ * Performing a plain linear scan entails a prioritization among
+ * actuators. The extra condition above breaks this prioritization and
+ * tends to distribute injection uniformly across actuators.
  */
 static struct bfq_queue *
 bfq_find_bfqq_for_underused_actuator(struct bfq_data *bfqd)
@@ -4824,7 +4830,9 @@ bfq_find_bfqq_for_underused_actuator(struct bfq_data *bfqd)
 	int i;
 
 	for (i = 0 ; i < bfqd->num_actuators; i++)
-		if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold) {
+		if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold &&
+		    (i == bfqd->num_actuators - 1 ||
+		     bfqd->rq_in_driver[i] < bfqd->rq_in_driver[i+1])) {
 			struct bfq_queue *bfqq =
 				bfq_find_active_bfqq_for_actuator(bfqd, i);
 
-- 
2.20.1


  parent reply	other threads:[~2022-11-03 16:27 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 16:26 [PATCH V6 0/8] block, bfq: extend bfq to support multi-actuator drives Paolo Valente
2022-11-03 16:26 ` [PATCH V6 1/8] block, bfq: split sync bfq_queues on a per-actuator basis Paolo Valente
2022-11-21  0:18   ` Damien Le Moal
2022-11-26 16:28     ` Paolo Valente
2022-11-28 14:32       ` Jens Axboe
2022-12-06  8:04     ` Paolo Valente
2022-11-03 16:26 ` [PATCH V6 2/8] block, bfq: forbid stable merging of queues associated with different actuators Paolo Valente
2022-11-21  0:20   ` Damien Le Moal
2022-11-03 16:26 ` [PATCH V6 3/8] block, bfq: move io_cq-persistent bfqq data into a dedicated struct Paolo Valente
2022-11-21  0:24   ` Damien Le Moal
2022-11-03 16:26 ` [PATCH V6 4/8] block, bfq: turn bfqq_data into an array in bfq_io_cq Paolo Valente
2022-11-21  0:39   ` Damien Le Moal
2022-12-06  8:00     ` Paolo Valente
2022-11-03 16:26 ` [PATCH V6 5/8] block, bfq: split also async bfq_queues on a per-actuator basis Paolo Valente
2022-11-21  0:52   ` Damien Le Moal
2022-11-03 16:26 ` [PATCH V6 6/8] block, bfq: retrieve independent access ranges from request queue Paolo Valente
2022-11-21  1:01   ` Damien Le Moal
2022-12-06  8:06     ` Paolo Valente
2022-12-06  8:29       ` Damien Le Moal
2022-12-06  8:41         ` Paolo Valente
2022-12-06  9:02           ` Damien Le Moal
2022-12-06 15:43             ` Paolo Valente
2022-12-06 23:34               ` Damien Le Moal
2022-12-08 10:43                 ` Paolo Valente
2022-11-03 16:26 ` [PATCH V6 7/8] block, bfq: inject I/O to underutilized actuators Paolo Valente
2022-11-21  1:17   ` Damien Le Moal
2022-11-03 16:26 ` Paolo Valente [this message]
2022-11-10 15:25   ` [PATCH V6 8/8] block, bfq: balance I/O injection among " Arie van der Hoeven
2022-11-20  7:29     ` Paolo Valente
2022-11-20 22:06       ` Jens Axboe
2022-11-20 23:41         ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221103162623.10286-9-paolo.valente@linaro.org \
    --to=paolo.valente@linaro.org \
    --cc=arie.vanderhoeven@seagate.com \
    --cc=axboe@kernel.dk \
    --cc=davidezini2@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rory.c.chen@seagate.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).