Linux block layer
 help / color / mirror / Atom feed
* [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch
@ 2025-09-26  2:38 chengkaitao
  2025-10-02 21:27 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: chengkaitao @ 2025-09-26  2:38 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, chengkaitao

From: chengkaitao <chengkaitao@kylinos.cn>

Reference function started_after()
Before modification:
	Timeout for dispatch{read}: 9.5s
	started_after - 0.5s < latest_start - 10s
	9.5s < latest_start - started_after

	Timeout for dispatch{write}: 5s
	started_after - 5s < latest_start - 10s
	5s < latest_start - started_after

At this point, write requests have higher priority than read requests.

After modification:
	Timeout for dispatch{read/write}: 5s
	prio_aging_expire / 2 < latest_start - started_after

Signed-off-by: chengkaitao <chengkaitao@kylinos.cn>
---
 block/mq-deadline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index b9b7cdf1d3c9..f311168f8dfe 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -672,7 +672,8 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 
 	if (flags & BLK_MQ_INSERT_AT_HEAD) {
 		list_add(&rq->queuelist, &per_prio->dispatch);
-		rq->fifo_time = jiffies;
+		rq->fifo_time = jiffies + dd->fifo_expire[data_dir]
+				- dd->prio_aging_expire / 2;
 	} else {
 		deadline_add_rq_rb(per_prio, rq);
 
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch
  2025-09-26  2:38 [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch chengkaitao
@ 2025-10-02 21:27 ` Jens Axboe
  2025-10-03  4:17 ` Damien Le Moal
  2025-10-03  4:19 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-10-02 21:27 UTC (permalink / raw)
  To: chengkaitao; +Cc: linux-block, linux-kernel, chengkaitao, Damien Le Moal

On 9/25/25 8:38 PM, chengkaitao wrote:
> From: chengkaitao <chengkaitao@kylinos.cn>
> 
> Reference function started_after()
> Before modification:
> 	Timeout for dispatch{read}: 9.5s
> 	started_after - 0.5s < latest_start - 10s
> 	9.5s < latest_start - started_after
> 
> 	Timeout for dispatch{write}: 5s
> 	started_after - 5s < latest_start - 10s
> 	5s < latest_start - started_after
> 
> At this point, write requests have higher priority than read requests.
> 
> After modification:
> 	Timeout for dispatch{read/write}: 5s
> 	prio_aging_expire / 2 < latest_start - started_after
> 
> Signed-off-by: chengkaitao <chengkaitao@kylinos.cn>
> ---
>  block/mq-deadline.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index b9b7cdf1d3c9..f311168f8dfe 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -672,7 +672,8 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  
>  	if (flags & BLK_MQ_INSERT_AT_HEAD) {
>  		list_add(&rq->queuelist, &per_prio->dispatch);
> -		rq->fifo_time = jiffies;
> +		rq->fifo_time = jiffies + dd->fifo_expire[data_dir]
> +				- dd->prio_aging_expire / 2;
>  	} else {
>  		deadline_add_rq_rb(per_prio, rq);
>  

Adding Damien as he's worked on mq-deadline the most recently.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch
  2025-09-26  2:38 [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch chengkaitao
  2025-10-02 21:27 ` Jens Axboe
@ 2025-10-03  4:17 ` Damien Le Moal
  2025-10-03  4:19 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-10-03  4:17 UTC (permalink / raw)
  To: chengkaitao, axboe; +Cc: linux-block, linux-kernel, chengkaitao

On 9/26/25 11:38, chengkaitao wrote:
> From: chengkaitao <chengkaitao@kylinos.cn>
> 
> Reference function started_after()

What does this mean ?

> Before modification:
> 	Timeout for dispatch{read}: 9.5s
> 	started_after - 0.5s < latest_start - 10s
> 	9.5s < latest_start - started_after
> 
> 	Timeout for dispatch{write}: 5s
> 	started_after - 5s < latest_start - 10s
> 	5s < latest_start - started_after
> 
> At this point, write requests have higher priority than read requests.
> 
> After modification:
> 	Timeout for dispatch{read/write}: 5s
> 	prio_aging_expire / 2 < latest_start - started_after

This is extremely hard to parse and understand. Can you please make full
sentences that explain what the problem is, and for your example, the starting
situation/state you are in ? E.g "If there are a lot of request inserted at
head, then ... Blah"

Also, in the title, s/timeout period/timeout

> Signed-off-by: chengkaitao <chengkaitao@kylinos.cn>
> ---
>  block/mq-deadline.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index b9b7cdf1d3c9..f311168f8dfe 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -672,7 +672,8 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  
>  	if (flags & BLK_MQ_INSERT_AT_HEAD) {
>  		list_add(&rq->queuelist, &per_prio->dispatch);
> -		rq->fifo_time = jiffies;
> +		rq->fifo_time = jiffies + dd->fifo_expire[data_dir]
> +				- dd->prio_aging_expire / 2;

The request is inserted to the dispatch list directly here. So why do we need to
change the timeout to switch to fifo ? Your commit message does not explain that
at all, and I do not see a trivial explanation for it myself. Please clarify.
I suspect that you have a situation where you see a lot of requeue at head and
that completely skew the fifo/prio aging ? I am memrely guessing here. Please
resend your patch with a clear commit message, and also a comment for the change
above explaining what is being done.

>  	} else {
>  		deadline_add_rq_rb(per_prio, rq);
>  


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch
  2025-09-26  2:38 [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch chengkaitao
  2025-10-02 21:27 ` Jens Axboe
  2025-10-03  4:17 ` Damien Le Moal
@ 2025-10-03  4:19 ` Damien Le Moal
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2025-10-03  4:19 UTC (permalink / raw)
  To: chengkaitao, axboe; +Cc: linux-block, linux-kernel, chengkaitao

On 9/26/25 11:38, chengkaitao wrote:
> From: chengkaitao <chengkaitao@kylinos.cn>
> 
> Reference function started_after()
> Before modification:
> 	Timeout for dispatch{read}: 9.5s
> 	started_after - 0.5s < latest_start - 10s
> 	9.5s < latest_start - started_after
> 
> 	Timeout for dispatch{write}: 5s
> 	started_after - 5s < latest_start - 10s
> 	5s < latest_start - started_after
> 
> At this point, write requests have higher priority than read requests.
> 
> After modification:
> 	Timeout for dispatch{read/write}: 5s
> 	prio_aging_expire / 2 < latest_start - started_after
> 
> Signed-off-by: chengkaitao <chengkaitao@kylinos.cn>

Also please write your name correctly here, separating first and last names with
a capital first letter for each (unless of course if this is your only
name/firstname, but still missing the capital letter).

> ---
>  block/mq-deadline.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/mq-deadline.c b/block/mq-deadline.c
> index b9b7cdf1d3c9..f311168f8dfe 100644
> --- a/block/mq-deadline.c
> +++ b/block/mq-deadline.c
> @@ -672,7 +672,8 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
>  
>  	if (flags & BLK_MQ_INSERT_AT_HEAD) {
>  		list_add(&rq->queuelist, &per_prio->dispatch);
> -		rq->fifo_time = jiffies;
> +		rq->fifo_time = jiffies + dd->fifo_expire[data_dir]
> +				- dd->prio_aging_expire / 2;
>  	} else {
>  		deadline_add_rq_rb(per_prio, rq);
>  


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-03  4:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26  2:38 [PATCH RESEND] block/mq-deadline: adjust the timeout period of the per_prio->dispatch chengkaitao
2025-10-02 21:27 ` Jens Axboe
2025-10-03  4:17 ` Damien Le Moal
2025-10-03  4:19 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox