[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240208093136.178797-3-zhaoyang.huang@unisoc.com>
Date: Thu, 8 Feb 2024 17:31:36 +0800
From: "zhaoyang.huang" <zhaoyang.huang@...soc.com>
To: Jens Axboe <axboe@...nel.dk>, Peter Zijlstra <peterz@...radead.org>,
Ingo
Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
Vincent
Guittot <vincent.guittot@...aro.org>,
Yu Zhao <yuzhao@...gle.com>, <linux-block@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Zhaoyang Huang
<huangzhaoyang@...il.com>, <steve.kang@...soc.com>
Subject: [PATCH 3/3] block: introducing a bias over deadline's fifo_time
From: Zhaoyang Huang <zhaoyang.huang@...soc.com>
According to current policy, RT tasks possess the privilege for both of
CPU and IO scheduler which could have the preempted CFS tasks suffer big
IO-latency unfairly. This commit introduce an approximate method to
deduct the preempt affection.
TaskA
sched in
|
|
|
submit_bio
|
|
|
fifo_time = jiffies + expire
(insert_request)
TaskB
sched in
|
|
preempted by RT task
|\
| This period time is unfair to TaskB's IO request, should be adjust
|/
submit_bio
|
|
|
fifo_time = jiffies + expire * CFS_PROPORTION(rq)
(insert_request)
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@...soc.com>
---
block/mq-deadline.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index f958e79277b8..43c08c3d6f18 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -15,6 +15,7 @@
#include <linux/compiler.h>
#include <linux/rbtree.h>
#include <linux/sbitmap.h>
+#include "../kernel/sched/sched.h"
#include <trace/events/block.h>
@@ -802,6 +803,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
u8 ioprio_class = IOPRIO_PRIO_CLASS(ioprio);
struct dd_per_prio *per_prio;
enum dd_prio prio;
+ int fifo_expire;
lockdep_assert_held(&dd->lock);
@@ -840,7 +842,9 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
/*
* set expire time and add to fifo list
*/
- rq->fifo_time = jiffies + dd->fifo_expire[data_dir];
+ fifo_expire = task_is_realtime(current) ? dd->fifo_expire[data_dir] :
+ CFS_PROPORTION(current, dd->fifo_expire[data_dir]);
+ rq->fifo_time = jiffies + fifo_expire;
insert_before = &per_prio->fifo_list[data_dir];
#ifdef CONFIG_BLK_DEV_ZONED
/*
--
2.25.1
Powered by blists - more mailing lists