[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cfefdf5c-984f-1505-be15-0cc9e79df31b@huaweicloud.com>
Date: Thu, 9 Oct 2025 14:42:00 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Yu Kuai <yukuai1@...weicloud.com>, Yu Kuai <hailan@...uai.org.cn>,
Nilay Shroff <nilay@...ux.ibm.com>, axboe@...nel.dk, bvanassche@....org,
ming.lei@...hat.com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
yi.zhang@...wei.com, yangerkun@...wei.com, johnny.chenyi@...wei.com,
"yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH 3/7] blk-mq: add a new queue sysfs attribute async_depth
Hi,
在 2025/10/09 8:48, Yu Kuai 写道:
> Hi,
>
> 在 2025/10/06 9:57, Yu Kuai 写道:
>> Hi,
>>
>> 在 2025/10/2 23:10, Nilay Shroff 写道:
>>>
>>> On 9/30/25 12:41 PM, Yu Kuai wrote:
>>>> From: Yu Kuai <yukuai3@...wei.com>
>>>>
>>>> Add a new field async_depth to request_queue and related APIs, this is
>>>> currently not used, following patches will convert elevators to use
>>>> this instead of internal async_depth.
>>>>
>>>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>>>> ---
>>>> block/blk-core.c | 1 +
>>>> block/blk-mq.c | 4 ++++
>>>> block/blk-sysfs.c | 47
>>>> ++++++++++++++++++++++++++++++++++++++++++
>>>> block/elevator.c | 1 +
>>>> include/linux/blkdev.h | 1 +
>>>> 5 files changed, 54 insertions(+)
>>>>
>>>> diff --git a/block/blk-core.c b/block/blk-core.c
>>>> index dd39ff651095..76df70cfc103 100644
>>>> --- a/block/blk-core.c
>>>> +++ b/block/blk-core.c
>>>> @@ -463,6 +463,7 @@ struct request_queue *blk_alloc_queue(struct
>>>> queue_limits *lim, int node_id)
>>>> fs_reclaim_release(GFP_KERNEL);
>>>> q->nr_requests = BLKDEV_DEFAULT_RQ;
>>>> + q->async_depth = BLKDEV_DEFAULT_RQ;
>>>> return q;
>>>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>>>> index 09f579414161..260e54fa48f0 100644
>>>> --- a/block/blk-mq.c
>>>> +++ b/block/blk-mq.c
>>>> @@ -529,6 +529,8 @@ static struct request
>>>> *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data)
>>>> data->rq_flags |= RQF_USE_SCHED;
>>>> if (ops->limit_depth)
>>>> ops->limit_depth(data->cmd_flags, data);
>>>> + else if (!blk_mq_sched_sync_request(data->cmd_flags))
>>>> + data->shallow_depth = q->async_depth;
>>>> }
>>> In the subsequent patches, I saw that ->limit_depth is still used for
>>> the
>>> BFQ scheduler. Given that, it seems more consistent to also retain
>>> ->limit_depth
>>> for the mq-deadline and Kyber schedulers, and set data->shallow_depth
>>> within their
>>> respective ->limit_depth methods. If we take this approach, the
>>> additional
>>> blk_mq_sched_sync_request() check above becomes unnecessary.
>>>
>>> So IMO:
>>> - Keep ->limit_depth for all schedulers (bfq, mq-deadline, kyber).
>>> - Remove the extra blk_mq_sched_sync_request() check from the core code.
>>
>> I was thinking to save a function call for deadline and kyber,
>> however, I don't
>> have preference here and I can do this in the next version.
>
> How abount following, I feel this is better while cooking the new
> version. Consider only bfq have specail handling for async request.
>
> static void blk_mq_sched_limit_async_depth(struct blk_mq_alloc_data *data)
> {
> if (blk_mq_sched_sync_request(data->cmd_flags))
> return;
>
> data->shallow_depth = q->async_depth;
> if (ops->limit_async_depth)
> ops->limit_async_depth(data);
> }
>
Just realize I forgot that bfq can limit sync requests as well due to
bfq cgroup policy, so this is not good.
Please ignore this :)
Thanks,
Kuai
> Thanks,
> Kuai
>
>>
>> Thanks,
>> Kuai
>>
>>> Thanks,
>>> --Nilay
>>>
>> .
>>
>
> .
>
Powered by blists - more mailing lists