Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block, bfq: balance I/O injection among underutilized actuators

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.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
Signed-off-by: Davide Zini <davidezini2@gmail.com>
Link: https://lore.kernel.org/r/20230103145503.71712-9-paolo.valente@linaro.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Davide Zini and committed by
Jens Axboe
1bd43e19 2d31c684

+13 -5
+13 -5
block/bfq-iosched.c
··· 4767 4767 4768 4768 /* 4769 4769 * Perform a linear scan of each actuator, until an actuator is found 4770 - * for which the following two conditions hold: the load of the 4771 - * actuator is below the threshold (see comments on actuator_load_threshold 4772 - * for details), and there is a queue that contains I/O for that 4773 - * actuator. On success, return that queue. 4770 + * for which the following three conditions hold: the load of the 4771 + * actuator is below the threshold (see comments on 4772 + * actuator_load_threshold for details) and lower than that of the 4773 + * next actuator (comments on this extra condition below), and there 4774 + * is a queue that contains I/O for that actuator. On success, return 4775 + * that queue. 4776 + * 4777 + * Performing a plain linear scan entails a prioritization among 4778 + * actuators. The extra condition above breaks this prioritization and 4779 + * tends to distribute injection uniformly across actuators. 4774 4780 */ 4775 4781 static struct bfq_queue * 4776 4782 bfq_find_bfqq_for_underused_actuator(struct bfq_data *bfqd) ··· 4784 4778 int i; 4785 4779 4786 4780 for (i = 0 ; i < bfqd->num_actuators; i++) { 4787 - if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold) { 4781 + if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold && 4782 + (i == bfqd->num_actuators - 1 || 4783 + bfqd->rq_in_driver[i] < bfqd->rq_in_driver[i+1])) { 4788 4784 struct bfq_queue *bfqq = 4789 4785 bfq_find_active_bfqq_for_actuator(bfqd, i); 4790 4786