From: "Wang Jianchao (Kuaishou)" <jianchao.wan9@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Josef Bacik <jbacik@fb.com>, Tejun Heo <tj@kernel.org>,
Bart Van Assche <bvanassche@acm.org>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC V5 10/16] blk-wbt: get rid of wbt_enable/disable_default()
Date: Thu, 24 Feb 2022 17:06:48 +0800 [thread overview]
Message-ID: <20220224090654.54671-11-jianchao.wan9@gmail.com> (raw)
In-Reply-To: <20220224090654.54671-1-jianchao.wan9@gmail.com>
wbt_enable_default() is used to open wbt feature by default.
wbt_disable_default() is only employed by bfq which has similar
writeback throttling mechanism. This kind of policy should be
selected by the user instead of being set in kernel. This patch
get rid of the interfaces and let the user configure appropricate
blk-rq-qos policy by themselves.
Signed-off-by: Wang Jianchao (Kuaishou) <jianchao.wan9@gmail.com>
---
block/bfq-iosched.c | 2 --
block/blk-sysfs.c | 3 +--
block/blk-wbt.c | 60 +--------------------------------------------
block/blk-wbt.h | 22 -----------------
block/elevator.c | 3 ---
5 files changed, 2 insertions(+), 88 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 0c612a911696..adbe5ff6c5e8 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -132,7 +132,6 @@
#include "blk-mq-tag.h"
#include "blk-mq-sched.h"
#include "bfq-iosched.h"
-#include "blk-wbt.h"
#define BFQ_BFQQ_FNS(name) \
void bfq_mark_bfqq_##name(struct bfq_queue *bfqq) \
@@ -7158,7 +7157,6 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
bfq_init_root_group(bfqd->root_group, bfqd);
bfq_init_entity(&bfqd->oom_bfqq.entity, bfqd->root_group);
- wbt_disable_default(q);
return 0;
out_free:
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 1b321edd7ba7..4563283dae07 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -17,8 +17,8 @@
#include "blk-mq.h"
#include "blk-mq-debugfs.h"
#include "blk-mq-sched.h"
-#include "blk-wbt.h"
#include "blk-throttle.h"
+#include "blk-rq-qos.h"
static ssize_t
queue_var_show(unsigned long var, char *page)
@@ -810,7 +810,6 @@ int blk_register_queue(struct gendisk *disk)
}
blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q);
- wbt_enable_default(q);
blk_throtl_register_queue(q);
/* Now everything is ready and send out KOBJ_ADD uevent */
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index bbec3b394273..6c0a85ddb107 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -86,8 +86,7 @@ enum {
static inline bool rwb_enabled(struct rq_wb *rwb)
{
- return rwb && rwb->enable_state != WBT_STATE_OFF_DEFAULT &&
- rwb->wb_normal != 0;
+ return rwb && rwb->wb_normal != 0;
}
static void wb_timestamp(struct rq_wb *rwb, unsigned long *var)
@@ -703,7 +702,6 @@ static ssize_t wbt_lat_store(struct request_queue *q, const char *page,
blk_mq_quiesce_queue(q);
rwb->min_lat_nsec = val;
- rwb->enable_state = WBT_STATE_ON_MANUAL;
wbt_update_limits(rwb);
blk_mq_unquiesce_queue(q);
@@ -734,26 +732,6 @@ static void wbt_exit(struct rq_qos *rqos)
__wbt_exit(rqos);
}
-/*
- * Disable wbt, if enabled by default.
- */
-void wbt_disable_default(struct request_queue *q)
-{
- struct rq_qos *rqos = wbt_rq_qos(q);
- struct rq_wb *rwb;
-
- if (!rqos)
- return;
-
- rwb = RQWB(rqos);
- if (rwb->enable_state == WBT_STATE_ON_DEFAULT) {
- blk_stat_deactivate(rwb->cb);
- rwb->enable_state = WBT_STATE_OFF_DEFAULT;
- }
- rq_qos_put(rqos);
-}
-EXPORT_SYMBOL_GPL(wbt_disable_default);
-
#ifdef CONFIG_BLK_DEBUG_FS
static int wbt_curr_win_nsec_show(void *data, struct seq_file *m)
{
@@ -764,15 +742,6 @@ static int wbt_curr_win_nsec_show(void *data, struct seq_file *m)
return 0;
}
-static int wbt_enabled_show(void *data, struct seq_file *m)
-{
- struct rq_qos *rqos = data;
- struct rq_wb *rwb = RQWB(rqos);
-
- seq_printf(m, "%d\n", rwb->enable_state);
- return 0;
-}
-
static int wbt_id_show(void *data, struct seq_file *m)
{
struct rq_qos *rqos = data;
@@ -831,7 +800,6 @@ static int wbt_background_show(void *data, struct seq_file *m)
static const struct blk_mq_debugfs_attr wbt_debugfs_attrs[] = {
{"curr_win_nsec", 0400, wbt_curr_win_nsec_show},
- {"enabled", 0400, wbt_enabled_show},
{"id", 0400, wbt_id_show},
{"inflight", 0400, wbt_inflight_show},
{"min_lat_nsec", 0400, wbt_min_lat_nsec_show},
@@ -862,7 +830,6 @@ static int wbt_init(struct request_queue *q)
rwb->last_comp = rwb->last_issue = jiffies;
rwb->win_nsec = RWB_WINDOW_NSEC;
- rwb->enable_state = WBT_STATE_ON_DEFAULT;
rwb->wc = 1;
rwb->rq_depth.default_depth = RWB_DEF_DEPTH;
@@ -900,31 +867,6 @@ static struct rq_qos_ops wbt_rqos_ops = {
#endif
};
-/*
- * Enable wbt if defaults are configured that way
- */
-void wbt_enable_default(struct request_queue *q)
-{
- struct rq_qos *rqos = wbt_rq_qos(q);
-
- /* Throttling already enabled? */
- if (rqos) {
- if (RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
- RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT;
-
- rq_qos_put(rqos);
- return;
- }
-
- /* Queue not registered? Maybe shutting down... */
- if (!blk_queue_registered(q))
- return;
-
- if (queue_is_mq(q) && IS_ENABLED(CONFIG_BLK_WBT_MQ))
- wbt_init(q);
-}
-EXPORT_SYMBOL_GPL(wbt_enable_default);
-
static __init int wbt_mod_init(void)
{
return rq_qos_register(&wbt_rqos_ops);
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index b9ed3f373b5a..fe26f78390bd 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -27,16 +27,6 @@ enum {
WBT_NUM_RWQ,
};
-/*
- * Enable states. Either off, or on by default (done at init time),
- * or on through manual setup in sysfs.
- */
-enum {
- WBT_STATE_ON_DEFAULT = 1,
- WBT_STATE_ON_MANUAL = 2,
- WBT_STATE_OFF_DEFAULT
-};
-
struct rq_wb {
/*
* Settings that govern how we throttle
@@ -44,8 +34,6 @@ struct rq_wb {
unsigned int wb_background; /* background writeback */
unsigned int wb_normal; /* normal writeback */
- short enable_state; /* WBT_STATE_* */
-
/*
* Number of consecutive periods where we don't have enough
* information to make a firm scale up/down decision.
@@ -85,12 +73,8 @@ static inline unsigned int wbt_inflight(struct rq_wb *rwb)
return ret;
}
-
#ifdef CONFIG_BLK_WBT
-void wbt_disable_default(struct request_queue *);
-void wbt_enable_default(struct request_queue *);
-
void wbt_set_write_cache(struct request_queue *, bool);
#else
@@ -98,12 +82,6 @@ void wbt_set_write_cache(struct request_queue *, bool);
static inline void wbt_track(struct request *rq, enum wbt_flags flags)
{
}
-static inline void wbt_disable_default(struct request_queue *q)
-{
-}
-static inline void wbt_enable_default(struct request_queue *q)
-{
-}
static inline void wbt_set_write_cache(struct request_queue *q, bool wc)
{
}
diff --git a/block/elevator.c b/block/elevator.c
index ec98aed39c4f..0da6fcf08d7b 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -43,7 +43,6 @@
#include "blk.h"
#include "blk-mq-sched.h"
#include "blk-pm.h"
-#include "blk-wbt.h"
static DEFINE_SPINLOCK(elv_list_lock);
static LIST_HEAD(elv_list);
@@ -525,8 +524,6 @@ void elv_unregister_queue(struct request_queue *q)
kobject_del(&e->kobj);
e->registered = 0;
- /* Re-enable throttling in case elevator disabled it */
- wbt_enable_default(q);
}
}
--
2.17.1
next prev parent reply other threads:[~2022-02-24 9:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 9:06 [RFC V5 0/16] blk: blk-rq-qos framework refactor and cleanup Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 01/16] blk: make the whole blk_mq_submit_bio under q_usage_counter Wang Jianchao (Kuaishou)
2022-02-24 13:38 ` Christoph Hellwig
2022-02-25 2:11 ` Wang Jianchao
2022-02-24 9:06 ` [RFC V5 02/16] blk/rq-qos: prepare to make blk-rq-qos pluggable Wang Jianchao (Kuaishou)
2022-02-24 13:45 ` Christoph Hellwig
2022-02-24 16:55 ` Tejun Heo
2022-02-24 9:06 ` [RFC V5 03/16] blk-wbt: make wbt pluggable Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 04/16] blk-iolatency: make iolatency pluggable Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 05/16] blk-iocost: make iocost pluggable Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 06/16] blk-ioprio: make ioprio pluggable Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 07/16] blk/rq-qos: get rid of unused interfaces of rqos Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 08/16] blk/rq-qos: export the sysfs for switching qos Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 09/16] blk-wbt: show wbt_lat_us sysfs interface only when wbt is opened Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` Wang Jianchao (Kuaishou) [this message]
2022-02-24 13:46 ` [RFC V5 10/16] blk-wbt: get rid of wbt_enable/disable_default() Christoph Hellwig
2022-02-24 16:56 ` Tejun Heo
2022-02-24 9:06 ` [RFC V5 11/16] blk/rq-qos: get rid of debugfs register in blk_mq_debugfs_register Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 12/16] blk/rq-qos: change queue_depth_changed to setting_changed Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 13/16] blk-wbt: move cache setting to rq_qos_setting_changed() Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 14/16] blk-wbt: cleanup the blk-wbt.h Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 15/16] blk/rq-qos: move the rqos debugfs code to blk-rq-qos.c Wang Jianchao (Kuaishou)
2022-02-24 9:06 ` [RFC V5 16/16] blk/rq-qos: add config to control the whole blk-rq-qos framework Wang Jianchao (Kuaishou)
2022-02-24 13:37 ` [RFC V5 0/16] blk: blk-rq-qos framework refactor and cleanup Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220224090654.54671-11-jianchao.wan9@gmail.com \
--to=jianchao.wan9@gmail.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=jbacik@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®