From: Paolo Valente <paolo.valente@linaro.org>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block <linux-block@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Arie van der Hoeven <arie.vanderhoeven@seagate.com>,
Rory Chen <rory.c.chen@seagate.com>,
Federico Gavioli <f.gavioli97@gmail.com>
Subject: Re: [PATCH V6 6/8] block, bfq: retrieve independent access ranges from request queue
Date: Tue, 6 Dec 2022 16:43:35 +0100 [thread overview]
Message-ID: <518C279B-8896-470A-9D8C-974F3BB886DB@linaro.org> (raw)
In-Reply-To: <6983f8b3-a320-ce32-ef0d-273d11dd8648@opensource.wdc.com>
> Il giorno 6 dic 2022, alle ore 10:02, Damien Le Moal <damien.lemoal@opensource.wdc.com> ha scritto:
>
> On 12/6/22 17:41, Paolo Valente wrote:
>>
>>
>>> Il giorno 6 dic 2022, alle ore 09:29, Damien Le Moal <damien.lemoal@opensource.wdc.com> ha scritto:
>>>
>>> On 12/6/22 17:06, Paolo Valente wrote:
>>>>
>>>>
>>>>> Il giorno 21 nov 2022, alle ore 02:01, Damien Le Moal <damien.lemoal@opensource.wdc.com> ha scritto:
>>>>>
>>>>
>>>> ...
>>>>
>>>>>
>>>>>> }
>>>>>>
>>>>>> static bool bfq_bio_merge(struct request_queue *q, struct bio *bio,
>>>>>> @@ -7144,6 +7159,8 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
>>>>>> {
>>>>>> struct bfq_data *bfqd;
>>>>>> struct elevator_queue *eq;
>>>>>> + unsigned int i;
>>>>>> + struct blk_independent_access_ranges *ia_ranges = q->disk->ia_ranges;
>>>>>>
>>>>>> eq = elevator_alloc(q, e);
>>>>>> if (!eq)
>>>>>> @@ -7187,10 +7204,31 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
>>>>>> bfqd->queue = q;
>>>>>>
>>>>>> /*
>>>>>> - * Multi-actuator support not complete yet, default to single
>>>>>> - * actuator for the moment.
>>>>>> + * If the disk supports multiple actuators, we copy the independent
>>>>>> + * access ranges from the request queue structure.
>>>>>> */
>>>>>> - bfqd->num_actuators = 1;
>>>>>> + spin_lock_irq(&q->queue_lock);
>>>>>> + if (ia_ranges) {
>>>>>> + /*
>>>>>> + * Check if the disk ia_ranges size exceeds the current bfq
>>>>>> + * actuator limit.
>>>>>> + */
>>>>>> + if (ia_ranges->nr_ia_ranges > BFQ_MAX_ACTUATORS) {
>>>>>> + pr_crit("nr_ia_ranges higher than act limit: iars=%d, max=%d.\n",
>>>>>> + ia_ranges->nr_ia_ranges, BFQ_MAX_ACTUATORS);
>>>>>> + pr_crit("Falling back to single actuator mode.\n");
>>>>>> + bfqd->num_actuators = 0;
>>>>>> + } else {
>>>>>> + bfqd->num_actuators = ia_ranges->nr_ia_ranges;
>>>>>> +
>>>>>> + for (i = 0; i < bfqd->num_actuators; i++)
>>>>>> + bfqd->ia_ranges[i] = ia_ranges->ia_range[i];
>>>>>> + }
>>>>>> + } else {
>>>>>> + bfqd->num_actuators = 0;
>>>>>
>>>>> That is very weird. The default should be 1 actuator.
>>>>> ia_ranges->nr_ia_ranges is 0 when the disk does not provide any range
>>>>> information, meaning it is a regular disk with a single actuator.
>>>>
>>>> Actually, IIUC this assignment to 0 seems to be done exactly when you
>>>> say that it should be done, i.e., when the disk does not provide any
>>>> range information (ia_ranges is NULL). Am I missing something else?
>>>
>>> No ranges reported means no extra actuators, so a single actuator an
>>> single LBA range for the entire device.
>>
>> I'm still confused, sorry. Where will I read sector ranges from, if
>> no sector range information is available (ia_ranges is NULL)?
>
> start = 0 and nr_sectors = bdev_nr_sectors(bdev).
> No ia_ranges to read.
>
ok, thanks
>>
>>> In that case, bfq should process
>>> all IOs using bfqd->ia_ranges[0]. The get range function will always
>>> return that range. That makes the code clean and avoids different path for
>>> nr_ranges == 1 and nr_ranges > 1. No ?
>>
>> Apart from the above point, for which maybe there is some other
>> source of information for getting ranges, I see the following issue.
>>
>> What you propose is to save sector information and trigger the
>> range-checking for loop also for the above single-actuator case. Yet
>> txecuting (one iteration of) that loop will will always result in
>> getting a 0 as index. So, what's the point is saving data and
>> executing code on each IO, for getting a static result that we already
>> know we will get?
>
> Surely, you can add an "if (bfqd->num_actuators ==1)" optimization in
> strategic places to optimize for regular devices with a single actuator,
> which bfqd->num_actuators == 1 *exactly* describes. Having
> "bfqd->num_actuators = 0" makes no sense to me.
>
Ok, I see your point at last, sorry. I'll check the code, but I think
that there is no problem in moving from 0 to 1 actuators for the case
ia_ranges == NULL. I meant to separate the case "single actuator with
ia_ranges available" (num_actuators = 1), from the case "no ia_ranges
available" (num_actuators = 0). But evidently things don't work as I
thought, and using the same value (1) is ok.
Just, let me avoid setting the fields bfqd->sector and
bfqd->nr_sectors for a case where we don't use them.
Thanks,
Paolo
> But if you feel strongly about this, feel free to ignore this.
>
>>
>> Thanks,
>> Paolo
>>
>>>
>>>>
>>>> Once again, all other suggestions applied. I'm about to submit a V7.
>>>>
>>>> Thanks,
>>>> Paolo
>>>>
>>>
>>> --
>>> Damien Le Moal
>>> Western Digital Research
>>
>
> --
> Damien Le Moal
> Western Digital Research
next prev parent reply other threads:[~2022-12-06 15:43 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 [this message]
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 ` [PATCH V6 8/8] block, bfq: balance I/O injection among " Paolo Valente
2022-11-10 15:25 ` 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=518C279B-8896-470A-9D8C-974F3BB886DB@linaro.org \
--to=paolo.valente@linaro.org \
--cc=arie.vanderhoeven@seagate.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=f.gavioli97@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).