[PATCH v3 07/14] bfq: introduce better_fairness for container scene
From: brookxu
Date: Thu Mar 25 2021 - 02:58:53 EST
From: Chunguang Xu <brookxu@xxxxxxxxxxx>
In the container scenario, in addition to throughput, we
also pay attention to Qos. In order to better support this
scenario, we introduce the better_fairness mode here. In
this mode, we expect to control the Qos of each group
according to its priority better. Only add configuration
interface here
Signed-off-by: Chunguang Xu <brookxu@xxxxxxxxxxx>
---
block/bfq-iosched.c | 22 ++++++++++++++++++++++
block/bfq-iosched.h | 10 ++++++++++
2 files changed, 32 insertions(+)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index ee8c457..e7bc5e2 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -6745,6 +6745,7 @@ static ssize_t __FUNC(struct elevator_queue *e, char *page) \
SHOW_FUNCTION(bfq_max_budget_show, bfqd->bfq_user_max_budget, 0);
SHOW_FUNCTION(bfq_timeout_sync_show, bfqd->bfq_timeout, 1);
SHOW_FUNCTION(bfq_strict_guarantees_show, bfqd->strict_guarantees, 0);
+SHOW_FUNCTION(bfq_better_fairness_show, bfqd->better_fairness, 0);
SHOW_FUNCTION(bfq_low_latency_show, bfqd->low_latency, 0);
#undef SHOW_FUNCTION
@@ -6886,6 +6887,26 @@ static ssize_t bfq_strict_guarantees_store(struct elevator_queue *e,
return count;
}
+static ssize_t bfq_better_fairness_store(struct elevator_queue *e,
+ const char *page, size_t count)
+{
+ struct bfq_data *bfqd = e->elevator_data;
+ unsigned long __data;
+ int ret;
+
+ ret = bfq_var_store(&__data, (page));
+ if (ret)
+ return ret;
+
+ if (__data > 1)
+ __data = 1;
+ if (__data == 0 && bfqd->better_fairness != 0)
+ bfq_end_wr(bfqd);
+ bfqd->better_fairness = __data;
+
+ return count;
+}
+
static ssize_t bfq_low_latency_store(struct elevator_queue *e,
const char *page, size_t count)
{
@@ -6919,6 +6940,7 @@ static ssize_t bfq_low_latency_store(struct elevator_queue *e,
BFQ_ATTR(max_budget),
BFQ_ATTR(timeout_sync),
BFQ_ATTR(strict_guarantees),
+ BFQ_ATTR(better_fairness),
BFQ_ATTR(low_latency),
__ATTR_NULL
};
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index f9ed1da..674de8b 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -672,6 +672,16 @@ struct bfq_data {
bool strict_guarantees;
/*
+ * If there is no prio preemption, we force the device to
+ * idle to ensure Qos. IO inject also has some additional
+ * restrictions. The inject/merge queue should come from the
+ * same class in the same group. Doing so will reduce the
+ * throughput of the system, but it can better guarantee
+ * the Qos of each group and real-time tasks.
+ */
+ bool better_fairness;
+
+ /*
* Last time at which a queue entered the current burst of
* queues being activated shortly after each other; for more
* details about this and the following parameters related to
--
1.8.3.1