* [PATCH -next 0/6] blk-wbt: minor fix and cleanup
@ 2023-05-11 1:45 Yu Kuai
2023-05-11 1:45 ` [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
` (5 more replies)
0 siblings, 6 replies; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
Yu Kuai (6):
blk-wbt: fix that wbt can't be disabled by default
blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
blk-wbt: don't enable wbt for bio based device
blk-wbt: remove deadcode to handle wbt enable/disable with io inflight
blk-wbt: cleanup rwb_enabled() and wbt_disabled()
blk-iocost: move wbt_enable/disable_default() out of spinlock
block/blk-iocost.c | 7 ++-
block/blk-sysfs.c | 147 ++++++++++++++++++++++++---------------------
block/blk-wbt.c | 26 ++------
block/blk-wbt.h | 19 ------
4 files changed, 88 insertions(+), 111 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:19 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
` (4 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
commit b11d31ae01e6 ("blk-wbt: remove unnecessary check in
wbt_enable_default()") removes the checking of CONFIG_BLK_WBT_MQ by
mistake, which is used to control enable or disable wbt by default.
Fix the problem by adding back the checking.
Fixes: b11d31ae01e6 ("blk-wbt: remove unnecessary check in wbt_enable_default()")
Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Link: https://lore.kernel.org/lkml/CAKXUXMzfKq_J9nKHGyr5P5rvUETY4B-fxoQD4sO+NYjFOfVtZA@mail.gmail.com/t/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-wbt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index e49a48684532..b1ab4688eb5c 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -730,8 +730,9 @@ void wbt_enable_default(struct gendisk *disk)
{
struct request_queue *q = disk->queue;
struct rq_qos *rqos;
- bool disable_flag = q->elevator &&
- test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags);
+ bool disable_flag = (q->elevator &&
+ test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags)) ||
+ !IS_ENABLED(CONFIG_BLK_WBT_MQ);
/* Throttling already enabled? */
rqos = wbt_rq_qos(q);
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
2023-05-11 1:45 ` [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:19 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device Yu Kuai
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
sysfs entry /sys/block/[device]/queue/wbt_lat_usec will be created even
if CONFIG_BLK_WBT is disabled, while read and write will always fail.
It doesn't make sense to create a sysfs entry that can't be accessed,
so don't create such entry.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-sysfs.c | 143 ++++++++++++++++++++++++----------------------
block/blk-wbt.h | 19 ------
2 files changed, 74 insertions(+), 88 deletions(-)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index a64208583853..6c1c4ba66bc0 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -47,19 +47,6 @@ queue_var_store(unsigned long *var, const char *page, size_t count)
return count;
}
-static ssize_t queue_var_store64(s64 *var, const char *page)
-{
- int err;
- s64 v;
-
- err = kstrtos64(page, 10, &v);
- if (err < 0)
- return err;
-
- *var = v;
- return 0;
-}
-
static ssize_t queue_requests_show(struct request_queue *q, char *page)
{
return queue_var_show(q->nr_requests, page);
@@ -451,61 +438,6 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
return count;
}
-static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
-{
- if (!wbt_rq_qos(q))
- return -EINVAL;
-
- if (wbt_disabled(q))
- return sprintf(page, "0\n");
-
- return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
-}
-
-static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
- size_t count)
-{
- struct rq_qos *rqos;
- ssize_t ret;
- s64 val;
-
- ret = queue_var_store64(&val, page);
- if (ret < 0)
- return ret;
- if (val < -1)
- return -EINVAL;
-
- rqos = wbt_rq_qos(q);
- if (!rqos) {
- ret = wbt_init(q->disk);
- if (ret)
- return ret;
- }
-
- if (val == -1)
- val = wbt_default_latency_nsec(q);
- else if (val >= 0)
- val *= 1000ULL;
-
- if (wbt_get_min_lat(q) == val)
- return count;
-
- /*
- * Ensure that the queue is idled, in case the latency update
- * ends up either enabling or disabling wbt completely. We can't
- * have IO inflight if that happens.
- */
- blk_mq_freeze_queue(q);
- blk_mq_quiesce_queue(q);
-
- wbt_set_min_lat(q, val);
-
- blk_mq_unquiesce_queue(q);
- blk_mq_unfreeze_queue(q);
-
- return count;
-}
-
static ssize_t queue_wc_show(struct request_queue *q, char *page)
{
if (test_bit(QUEUE_FLAG_WC, &q->queue_flags))
@@ -598,7 +530,6 @@ QUEUE_RW_ENTRY(queue_wc, "write_cache");
QUEUE_RO_ENTRY(queue_fua, "fua");
QUEUE_RO_ENTRY(queue_dax, "dax");
QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout");
-QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
QUEUE_RO_ENTRY(queue_dma_alignment, "dma_alignment");
@@ -617,6 +548,78 @@ QUEUE_RW_ENTRY(queue_iostats, "iostats");
QUEUE_RW_ENTRY(queue_random, "add_random");
QUEUE_RW_ENTRY(queue_stable_writes, "stable_writes");
+#ifdef CONFIG_BLK_WBT
+static ssize_t queue_var_store64(s64 *var, const char *page)
+{
+ int err;
+ s64 v;
+
+ err = kstrtos64(page, 10, &v);
+ if (err < 0)
+ return err;
+
+ *var = v;
+ return 0;
+}
+
+static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
+{
+ if (!wbt_rq_qos(q))
+ return -EINVAL;
+
+ if (wbt_disabled(q))
+ return sprintf(page, "0\n");
+
+ return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
+}
+
+static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
+ size_t count)
+{
+ struct rq_qos *rqos;
+ ssize_t ret;
+ s64 val;
+
+ ret = queue_var_store64(&val, page);
+ if (ret < 0)
+ return ret;
+ if (val < -1)
+ return -EINVAL;
+
+ rqos = wbt_rq_qos(q);
+ if (!rqos) {
+ ret = wbt_init(q->disk);
+ if (ret)
+ return ret;
+ }
+
+ if (val == -1)
+ val = wbt_default_latency_nsec(q);
+ else if (val >= 0)
+ val *= 1000ULL;
+
+ if (wbt_get_min_lat(q) == val)
+ return count;
+
+ /*
+ * Ensure that the queue is idled, in case the latency update
+ * ends up either enabling or disabling wbt completely. We can't
+ * have IO inflight if that happens.
+ */
+ blk_mq_freeze_queue(q);
+ blk_mq_quiesce_queue(q);
+
+ wbt_set_min_lat(q, val);
+
+ blk_mq_unquiesce_queue(q);
+ blk_mq_unfreeze_queue(q);
+
+ return count;
+}
+
+QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
+#endif
+
static struct attribute *queue_attrs[] = {
&queue_requests_entry.attr,
&queue_ra_entry.attr,
@@ -655,7 +658,9 @@ static struct attribute *queue_attrs[] = {
&queue_wc_entry.attr,
&queue_fua_entry.attr,
&queue_dax_entry.attr,
+#ifdef CONFIG_BLK_WBT
&queue_wb_lat_entry.attr,
+#endif
&queue_poll_delay_entry.attr,
&queue_io_timeout_entry.attr,
#ifdef CONFIG_BLK_DEV_THROTTLING_LOW
diff --git a/block/blk-wbt.h b/block/blk-wbt.h
index ba6cca5849a6..8a029e138f7a 100644
--- a/block/blk-wbt.h
+++ b/block/blk-wbt.h
@@ -18,10 +18,6 @@ u64 wbt_default_latency_nsec(struct request_queue *);
#else
-static inline int wbt_init(struct gendisk *disk)
-{
- return -EINVAL;
-}
static inline void wbt_disable_default(struct gendisk *disk)
{
}
@@ -31,21 +27,6 @@ static inline void wbt_enable_default(struct gendisk *disk)
static inline void wbt_set_write_cache(struct request_queue *q, bool wc)
{
}
-static inline u64 wbt_get_min_lat(struct request_queue *q)
-{
- return 0;
-}
-static inline void wbt_set_min_lat(struct request_queue *q, u64 val)
-{
-}
-static inline u64 wbt_default_latency_nsec(struct request_queue *q)
-{
- return 0;
-}
-static inline bool wbt_disabled(struct request_queue *q)
-{
- return true;
-}
#endif /* CONFIG_BLK_WBT */
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
2023-05-11 1:45 ` [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
2023-05-11 1:45 ` [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:21 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight Yu Kuai
` (2 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
Because rq_qos only make sense for rq based device. Instead of fail
from sysfs configuration, make wbt sysfs dentry invisible directly.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6c1c4ba66bc0..c8e1f1462422 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -686,6 +686,10 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
!blk_queue_is_zoned(q))
return 0;
+#ifdef CONFIG_BLK_WBT
+ if (attr == &queue_wb_lat_entry.attr && !queue_is_mq(q))
+ return 0;
+#endif
return attr->mode;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
` (2 preceding siblings ...)
2023-05-11 1:45 ` [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:21 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
2023-05-11 1:45 ` [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
enable or disable wbt is always called with queue freezed, so that wbt
can never be enabled or disabled while io is still inflight, and this
behaviour should always hold to avoid io hang(There have been reported
several times).
Therefor, the code to handle wbt enable/diskble with io inflight is not
and never will be used, hence remove such deadcode.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-wbt.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index b1ab4688eb5c..7a9a30da8650 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -200,15 +200,6 @@ static void wbt_rqw_done(struct rq_wb *rwb, struct rq_wait *rqw,
inflight = atomic_dec_return(&rqw->inflight);
- /*
- * wbt got disabled with IO in flight. Wake up any potential
- * waiters, we don't have to do more than that.
- */
- if (unlikely(!rwb_enabled(rwb))) {
- rwb_wake_all(rwb);
- return;
- }
-
/*
* For discards, our limit is always the background. For writes, if
* the device does write back caching, drop further down before we
@@ -545,13 +536,6 @@ static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
{
unsigned int limit;
- /*
- * If we got disabled, just return UINT_MAX. This ensures that
- * we'll properly inc a new IO, and dec+wakeup at the end.
- */
- if (!rwb_enabled(rwb))
- return UINT_MAX;
-
if ((opf & REQ_OP_MASK) == REQ_OP_DISCARD)
return rwb->wb_background;
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled()
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
` (3 preceding siblings ...)
2023-05-11 1:45 ` [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:23 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
The code is redundant, reuse rwb_enabled() for wbt_disabled().
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-wbt.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 7a9a30da8650..7066fc2c1e5d 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -146,7 +146,7 @@ enum {
static inline bool rwb_enabled(struct rq_wb *rwb)
{
return rwb && rwb->enable_state != WBT_STATE_OFF_DEFAULT &&
- rwb->wb_normal != 0;
+ rwb->enable_state != WBT_STATE_OFF_MANUAL;
}
static void wb_timestamp(struct rq_wb *rwb, unsigned long *var)
@@ -494,8 +494,7 @@ bool wbt_disabled(struct request_queue *q)
{
struct rq_qos *rqos = wbt_rq_qos(q);
- return !rqos || RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT ||
- RQWB(rqos)->enable_state == WBT_STATE_OFF_MANUAL;
+ return !rqos || !rwb_enabled(RQWB(rqos));
}
u64 wbt_get_min_lat(struct request_queue *q)
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
` (4 preceding siblings ...)
2023-05-11 1:45 ` [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
@ 2023-05-11 1:45 ` Yu Kuai
2023-05-11 15:25 ` Christoph Hellwig
5 siblings, 1 reply; 16+ messages in thread
From: Yu Kuai @ 2023-05-11 1:45 UTC (permalink / raw)
To: hch, tj, josef, axboe, yukuai3
Cc: cgroups, linux-block, linux-kernel, yukuai1, yi.zhang, yangerkun
From: Yu Kuai <yukuai3@huawei.com>
There are following smatch warning:
block/blk-wbt.c:843 wbt_init() warn: sleeping in atomic context
ioc_qos_write() <- disables preempt
-> wbt_enable_default()
-> wbt_init()
wbt_init() will be called from wbt_enable_default() if wbt is not
initialized, currently this is only possible in blk_register_queue(), hence
wbt_init() will never be called from iocost and this warning is false
positive.
However, we might support rq_qos destruction dynamically in the future,
and it's better to prevent that, hence move wbt_enable_default() outside
'ioc->lock'. This is safe because queue is still freezed.
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/lkml/Y+Ja5SRs886CEz7a@kadam/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
block/blk-iocost.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 285ced3467ab..eb57e7e4f2db 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3300,11 +3300,9 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
blk_stat_enable_accounting(disk->queue);
blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
ioc->enabled = true;
- wbt_disable_default(disk);
} else {
blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
ioc->enabled = false;
- wbt_enable_default(disk);
}
if (user) {
@@ -3317,6 +3315,11 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
ioc_refresh_params(ioc, true);
spin_unlock_irq(&ioc->lock);
+ if (enable)
+ wbt_disable_default(disk);
+ else
+ wbt_enable_default(disk);
+
blk_mq_unquiesce_queue(disk->queue);
blk_mq_unfreeze_queue(disk->queue);
--
2.39.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default
2023-05-11 1:45 ` [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
@ 2023-05-11 15:19 ` Christoph Hellwig
2023-05-12 7:03 ` Yu Kuai
0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:19 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
On Thu, May 11, 2023 at 09:45:04AM +0800, Yu Kuai wrote:
> @@ -730,8 +730,9 @@ void wbt_enable_default(struct gendisk *disk)
> {
> struct request_queue *q = disk->queue;
> struct rq_qos *rqos;
> - bool disable_flag = q->elevator &&
> - test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags);
> + bool disable_flag = (q->elevator &&
> + test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags)) ||
> + !IS_ENABLED(CONFIG_BLK_WBT_MQ);
Not really new in your patch, but I find the logic here very confusing.
First the disable_flag really should be enable instead, as that's how
it's actually checked, and then spelling out the conditions a bit more
would really help readability. E.g.
bool enabled = IS_ENABLED(CONFIG_BLK_WBT_MQ);
if (q->elevator &&
test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags))
enable = false;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled
2023-05-11 1:45 ` [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
@ 2023-05-11 15:19 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:19 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device
2023-05-11 1:45 ` [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device Yu Kuai
@ 2023-05-11 15:21 ` Christoph Hellwig
2023-05-12 7:06 ` Yu Kuai
0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:21 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
On Thu, May 11, 2023 at 09:45:06AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> Because rq_qos only make sense for rq based device. Instead of fail
> from sysfs configuration, make wbt sysfs dentry invisible directly.
This looks ok, bt I would be better to just have a separate attr
group just for blk-mq based devices?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight
2023-05-11 1:45 ` [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight Yu Kuai
@ 2023-05-11 15:21 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:21 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
s/deadcode/dead code/
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled()
2023-05-11 1:45 ` [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
@ 2023-05-11 15:23 ` Christoph Hellwig
2023-05-12 7:07 ` Yu Kuai
0 siblings, 1 reply; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:23 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
On Thu, May 11, 2023 at 09:45:08AM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
>
> The code is redundant, reuse rwb_enabled() for wbt_disabled().
This also changes how rwb_enabled is implemented.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock
2023-05-11 1:45 ` [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
@ 2023-05-11 15:25 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2023-05-11 15:25 UTC (permalink / raw)
To: Yu Kuai
Cc: hch, tj, josef, axboe, yukuai3, cgroups, linux-block,
linux-kernel, yi.zhang, yangerkun
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default
2023-05-11 15:19 ` Christoph Hellwig
@ 2023-05-12 7:03 ` Yu Kuai
0 siblings, 0 replies; 16+ messages in thread
From: Yu Kuai @ 2023-05-12 7:03 UTC (permalink / raw)
To: Christoph Hellwig, Yu Kuai
Cc: tj, josef, axboe, cgroups, linux-block, linux-kernel, yi.zhang,
yangerkun, yukuai (C)
Hi,
在 2023/05/11 23:19, Christoph Hellwig 写道:
> On Thu, May 11, 2023 at 09:45:04AM +0800, Yu Kuai wrote:
>> @@ -730,8 +730,9 @@ void wbt_enable_default(struct gendisk *disk)
>> {
>> struct request_queue *q = disk->queue;
>> struct rq_qos *rqos;
>> - bool disable_flag = q->elevator &&
>> - test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags);
>> + bool disable_flag = (q->elevator &&
>> + test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags)) ||
>> + !IS_ENABLED(CONFIG_BLK_WBT_MQ);
>
> Not really new in your patch, but I find the logic here very confusing.
> First the disable_flag really should be enable instead, as that's how
> it's actually checked, and then spelling out the conditions a bit more
> would really help readability. E.g.
>
> bool enabled = IS_ENABLED(CONFIG_BLK_WBT_MQ);
>
> if (q->elevator &&
> test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags))
> enable = false;
Of course, this looks better, I'll do this in v2.
Thanks,
Kuai
>
>
> .
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device
2023-05-11 15:21 ` Christoph Hellwig
@ 2023-05-12 7:06 ` Yu Kuai
0 siblings, 0 replies; 16+ messages in thread
From: Yu Kuai @ 2023-05-12 7:06 UTC (permalink / raw)
To: Christoph Hellwig, Yu Kuai
Cc: tj, josef, axboe, cgroups, linux-block, linux-kernel, yi.zhang,
yangerkun, yukuai (C)
Hi,
在 2023/05/11 23:21, Christoph Hellwig 写道:
> On Thu, May 11, 2023 at 09:45:06AM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> Because rq_qos only make sense for rq based device. Instead of fail
>> from sysfs configuration, make wbt sysfs dentry invisible directly.
>
> This looks ok, bt I would be better to just have a separate attr
> group just for blk-mq based devices?
>
Sounds good, I'll add a new attr_group that is only visible for rq based
device, I think following attr can be moved to this new group:
nr_requests,
rq_affinity,
scheduler,
wbt_lat_usec
Thanks,
Kuai
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled()
2023-05-11 15:23 ` Christoph Hellwig
@ 2023-05-12 7:07 ` Yu Kuai
0 siblings, 0 replies; 16+ messages in thread
From: Yu Kuai @ 2023-05-12 7:07 UTC (permalink / raw)
To: Christoph Hellwig, Yu Kuai
Cc: tj, josef, axboe, cgroups, linux-block, linux-kernel, yi.zhang,
yangerkun, yukuai (C)
Hi,
在 2023/05/11 23:23, Christoph Hellwig 写道:
> On Thu, May 11, 2023 at 09:45:08AM +0800, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@huawei.com>
>>
>> The code is redundant, reuse rwb_enabled() for wbt_disabled().
>
> This also changes how rwb_enabled is implemented.
>
'rwb->wb_normal == 0' should be the same as 'rwb->enable_state ==
WBT_STATE_OFF_MANUAL', I'll explain in detail in v2.
Thanks,
Kuai
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-05-12 7:26 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 1:45 [PATCH -next 0/6] blk-wbt: minor fix and cleanup Yu Kuai
2023-05-11 1:45 ` [PATCH -next 1/6] blk-wbt: fix that wbt can't be disabled by default Yu Kuai
2023-05-11 15:19 ` Christoph Hellwig
2023-05-12 7:03 ` Yu Kuai
2023-05-11 1:45 ` [PATCH -next 2/6] blk-wbt: don't create wbt sysfs entry if CONFIG_BLK_WBT is disabled Yu Kuai
2023-05-11 15:19 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 3/6] blk-wbt: don't enable wbt for bio based device Yu Kuai
2023-05-11 15:21 ` Christoph Hellwig
2023-05-12 7:06 ` Yu Kuai
2023-05-11 1:45 ` [PATCH -next 4/6] blk-wbt: remove deadcode to handle wbt enable/disable with io inflight Yu Kuai
2023-05-11 15:21 ` Christoph Hellwig
2023-05-11 1:45 ` [PATCH -next 5/6] blk-wbt: cleanup rwb_enabled() and wbt_disabled() Yu Kuai
2023-05-11 15:23 ` Christoph Hellwig
2023-05-12 7:07 ` Yu Kuai
2023-05-11 1:45 ` [PATCH -next 6/6] blk-iocost: move wbt_enable/disable_default() out of spinlock Yu Kuai
2023-05-11 15:25 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).