mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yuwei Guan <ssawgyw@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: paolo.valente@linaro.org, axboe@kernel.dk,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yuwei.Guan@zeekrlife.com
Subject: Re: [PATCH] bfq: do try insert merge before bfq_init_rq() call
Date: Sat, 15 Oct 2022 11:32:27 +0800	[thread overview]
Message-ID: <57bd392b-45a6-929c-8be1-b0f6cff1da31@gmail.com> (raw)
In-Reply-To: <20221014145004.gqqpa5uvgg576tej@quack3>


On 2022/10/14 22:50, Jan Kara wrote:
> On Thu 13-10-22 21:53:21, Yuwei Guan wrote:
>> It's useless to do bfq_init_rq(rq), if the rq can do merge first.
>>
>> In the patch 5f550ede5edf8, it moved to bfq_init_rq() before
>> blk_mq_sched_try_insert_merge(), but it's pointless,
>> as the fifo_time of next is not set yet,
>> and !list_empty(&next->queuelist) is 0, so it does not
>> need to reposition rq's fifo_time.
>>
>> And for the "hash lookup, try again" situation, as follow,
>> bfq_requests_merged() call can work normally.
>>
>> blk_mq_sched_try_insert_merge
>>    elv_attempt_insert_merge
>>      elv_rqhash_find
>>
>> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
> OK, after some thinking I agree. How much testing has this patch got?
> Because I'd like to verify we didn't overlook something.
>
> 							Honza
Thanks for reviewing.
I tested it with fio seq read case like bellow,
then check blk trace and bfq log.

[global]
name=fio-seq-reads
filename=fio-seq-reads
rw=read
bs=16K
direct=1
numjobs=4

[file1]
size=32m
ioengine=psync

What kinds of test cases you perfer to do, I will deal with them,
or we verify this patch together, if you have free time. :)
>> ---
>>   block/bfq-iosched.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
>> index 7ea427817f7f..9845370a701c 100644
>> --- a/block/bfq-iosched.c
>> +++ b/block/bfq-iosched.c
>> @@ -6147,7 +6147,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>>   		bfqg_stats_update_legacy_io(q, rq);
>>   #endif
>>   	spin_lock_irq(&bfqd->lock);
>> -	bfqq = bfq_init_rq(rq);
>> +
>>   	if (blk_mq_sched_try_insert_merge(q, rq, &free)) {
>>   		spin_unlock_irq(&bfqd->lock);
>>   		blk_mq_free_requests(&free);
>> @@ -6156,6 +6156,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>>   
>>   	trace_block_rq_insert(rq);
>>   
>> +	bfqq = bfq_init_rq(rq);
>>   	if (!bfqq || at_head) {
>>   		if (at_head)
>>   			list_add(&rq->queuelist, &bfqd->dispatch);
>> -- 
>> 2.34.1
>>

  reply	other threads:[~2022-10-15  3:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 13:53 Yuwei Guan
2022-10-14 14:50 ` Jan Kara
2022-10-15  3:32   ` Yuwei Guan [this message]
2022-10-16 10:01     ` Paolo Valente

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=57bd392b-45a6-929c-8be1-b0f6cff1da31@gmail.com \
    --to=ssawgyw@gmail.com \
    --cc=Yuwei.Guan@zeekrlife.com \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    /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

all inboxes | Powered by JetHome®