diff mbox series

[v2,3/4] block/elevator: choose none elevator for high IO concurrency ability disk

Message ID 20241217024047.1091893-4-yukuai1@huaweicloud.com (mailing list archive)
State New
Headers show
Series lib/sbitmap: fix shallow_depth tag allocation | expand

Commit Message

Yu Kuai Dec. 17, 2024, 2:40 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

The maximal default nr_requests is 256, and if disk can handle more than
256 requests concurrently, use elevator in this case is useless, on the
one hand it limits the number of requests to 256, on the other hand,
it can't merge or sort IO because requests are dispatched to disk
immediately and the elevator is just empty.

For example, for nvme megaraid with 512 queue_depth by default, we have
to change default elevator to none, otherwise deadline will lose a lot of
performance.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/elevator.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Bart Van Assche Dec. 17, 2024, 9:50 p.m. UTC | #1
On 12/16/24 6:40 PM, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> The maximal default nr_requests is 256, and if disk can handle more than
> 256 requests concurrently, use elevator in this case is useless, on the
> one hand it limits the number of requests to 256, on the other hand,
> it can't merge or sort IO because requests are dispatched to disk
> immediately and the elevator is just empty.
> 
> For example, for nvme megaraid with 512 queue_depth by default, we have
> to change default elevator to none, otherwise deadline will lose a lot of
> performance.
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>   block/elevator.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/block/elevator.c b/block/elevator.c
> index 7c3ba80e5ff4..4cce1e7c47d5 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -568,6 +568,17 @@ static struct elevator_type *elevator_get_default(struct request_queue *q)
>   	    !blk_mq_is_shared_tags(q->tag_set->flags))
>   		return NULL;
>   
> +	/*
> +	 * If nr_queues will be less than disk ability, requests will be
> +	 * dispatched to disk immediately, it's useless to use elevator. User
> +	 * should set a bigger nr_requests or limit disk ability manually if
> +	 * they really want to use elevator.
> +	 */
> +	if (q->queue_depth && q->queue_depth >= BLKDEV_DEFAULT_RQ * 2)
> +		return NULL;
> +	if (!q->queue_depth && q->tag_set->queue_depth >= BLKDEV_DEFAULT_RQ * 2)
> +		return NULL;
> +
>   	return elevator_find_get("mq-deadline");
>   }

Shouldn't this patch be submitted separately since it is independent of
the rest of the patches in this series?

Thanks,

Bart.
Yu Kuai Dec. 18, 2024, 1:28 a.m. UTC | #2
Hi,

在 2024/12/18 5:50, Bart Van Assche 写道:
> On 12/16/24 6:40 PM, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> The maximal default nr_requests is 256, and if disk can handle more than
>> 256 requests concurrently, use elevator in this case is useless, on the
>> one hand it limits the number of requests to 256, on the other hand,
>> it can't merge or sort IO because requests are dispatched to disk
>> immediately and the elevator is just empty.
>>
>> For example, for nvme megaraid with 512 queue_depth by default, we have
>> to change default elevator to none, otherwise deadline will lose a lot of
>> performance.
>>
>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>> ---
>>   block/elevator.c | 11 +++++++++++
>>   1 file changed, 11 insertions(+)
>>
>> diff --git a/block/elevator.c b/block/elevator.c
>> index 7c3ba80e5ff4..4cce1e7c47d5 100644
>> --- a/block/elevator.c
>> +++ b/block/elevator.c
>> @@ -568,6 +568,17 @@ static struct elevator_type 
>> *elevator_get_default(struct request_queue *q)
>>           !blk_mq_is_shared_tags(q->tag_set->flags))
>>           return NULL;
>> +    /*
>> +     * If nr_queues will be less than disk ability, requests will be
>> +     * dispatched to disk immediately, it's useless to use elevator. 
>> User
>> +     * should set a bigger nr_requests or limit disk ability manually if
>> +     * they really want to use elevator.
>> +     */
>> +    if (q->queue_depth && q->queue_depth >= BLKDEV_DEFAULT_RQ * 2)
>> +        return NULL;
>> +    if (!q->queue_depth && q->tag_set->queue_depth >= 
>> BLKDEV_DEFAULT_RQ * 2)
>> +        return NULL;
>> +
>>       return elevator_find_get("mq-deadline");
>>   }
> 
> Shouldn't this patch be submitted separately since it is independent of
> the rest of the patches in this series?

Yes, this patch was added to this set by mistake. My bad. :(
I'm supposed to use the cleanup patch from v1 to replace this patch.

Thanks,
Kuai

> 
> Thanks,
> 
> Bart.
> 
> 
> .
>
diff mbox series

Patch

diff --git a/block/elevator.c b/block/elevator.c
index 7c3ba80e5ff4..4cce1e7c47d5 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -568,6 +568,17 @@  static struct elevator_type *elevator_get_default(struct request_queue *q)
 	    !blk_mq_is_shared_tags(q->tag_set->flags))
 		return NULL;
 
+	/*
+	 * If nr_queues will be less than disk ability, requests will be
+	 * dispatched to disk immediately, it's useless to use elevator. User
+	 * should set a bigger nr_requests or limit disk ability manually if
+	 * they really want to use elevator.
+	 */
+	if (q->queue_depth && q->queue_depth >= BLKDEV_DEFAULT_RQ * 2)
+		return NULL;
+	if (!q->queue_depth && q->tag_set->queue_depth >= BLKDEV_DEFAULT_RQ * 2)
+		return NULL;
+
 	return elevator_find_get("mq-deadline");
 }