public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: Jan Kara <jack@suse.cz>,
	paolo.valente@linaro.org, axboe@kernel.dk,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	yi.zhang@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v3 1/5] wbt: don't show valid wbt_lat_usec in sysfs while wbt is disabled
Date: Mon, 26 Sep 2022 13:47:26 +0200	[thread overview]
Message-ID: <20220926114726.ta2w3vcbxgkh3sov@quack3> (raw)
In-Reply-To: <6736753f-b5ae-39f1-b0c4-508b7f45d701@huaweicloud.com>

On Mon 26-09-22 18:25:18, Yu Kuai wrote:
> Hi, Jan
> 
> 在 2022/09/26 17:44, Jan Kara 写道:
> > On Thu 22-09-22 19:35:54, Yu Kuai wrote:
> > > Currently, if wbt is initialized and then disabled by
> > > wbt_disable_default(), sysfs will still show valid wbt_lat_usec, which
> > > will confuse users that wbt is still enabled.
> > > 
> > > This patch shows wbt_lat_usec as zero and forbid to set it while wbt
> > > is disabled.
> > 
> > So I agree we should show 0 in wbt_lat_usec if wbt is disabled by
> > wbt_disable_default(). But why do you forbid setting of wbt_lat_usec?
> > IMHO if wbt_lat_usec is set, admin wants to turn on wbt so we should just
> > update rwb->enable_state to WBT_STATE_ON_MANUAL.
> 
> I was thinking that don't enable wbt if elevator is bfq. Since we know
> that performance is bad, thus it doesn't make sense to me to do that,
> and user might doesn't aware of the problem.

Yeah, I don't think it is a good idea (that is the reason why it is
disabled by default) but in priciple I don't see a reason why we should
block admin from enabling it.

								Honza

> > > 
> > > Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> > > Reported-and-tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
> > > ---
> > >   block/blk-sysfs.c | 9 ++++++++-
> > >   block/blk-wbt.c   | 7 +++++++
> > >   block/blk-wbt.h   | 5 +++++
> > >   3 files changed, 20 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> > > index e1f009aba6fd..1955bb6a284d 100644
> > > --- a/block/blk-sysfs.c
> > > +++ b/block/blk-sysfs.c
> > > @@ -467,10 +467,14 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,
> > >   static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
> > >   {
> > > +	u64 lat;
> > > +
> > >   	if (!wbt_rq_qos(q))
> > >   		return -EINVAL;
> > > -	return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
> > > +	lat = wbt_disabled(q) ? 0 : div_u64(wbt_get_min_lat(q), 1000);
> > > +
> > > +	return sprintf(page, "%llu\n", lat);
> > >   }
> > >   static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
> > > @@ -493,6 +497,9 @@ static ssize_t queue_wb_lat_store(struct request_queue *q, const char *page,
> > >   			return ret;
> > >   	}
> > > +	if (wbt_disabled(q))
> > > +		return -EINVAL;
> > > +
> > >   	if (val == -1)
> > >   		val = wbt_default_latency_nsec(q);
> > >   	else if (val >= 0)
> > > diff --git a/block/blk-wbt.c b/block/blk-wbt.c
> > > index a9982000b667..68851c2c02d2 100644
> > > --- a/block/blk-wbt.c
> > > +++ b/block/blk-wbt.c
> > > @@ -422,6 +422,13 @@ static void wbt_update_limits(struct rq_wb *rwb)
> > >   	rwb_wake_all(rwb);
> > >   }
> > > +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;
> > > +}
> > > +
> > >   u64 wbt_get_min_lat(struct request_queue *q)
> > >   {
> > >   	struct rq_qos *rqos = wbt_rq_qos(q);
> > > diff --git a/block/blk-wbt.h b/block/blk-wbt.h
> > > index 7e44eccc676d..e42465ddcbb6 100644
> > > --- a/block/blk-wbt.h
> > > +++ b/block/blk-wbt.h
> > > @@ -94,6 +94,7 @@ void wbt_enable_default(struct request_queue *);
> > >   u64 wbt_get_min_lat(struct request_queue *q);
> > >   void wbt_set_min_lat(struct request_queue *q, u64 val);
> > > +bool wbt_disabled(struct request_queue *);
> > >   void wbt_set_write_cache(struct request_queue *, bool);
> > > @@ -125,6 +126,10 @@ 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.31.1
> > > 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-09-26 14:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 11:35 [PATCH v3 0/5] blk-wbt: simple improvment to enable wbt correctly Yu Kuai
2022-09-22 11:35 ` [PATCH v3 1/5] wbt: don't show valid wbt_lat_usec in sysfs while wbt is disabled Yu Kuai
2022-09-26  9:44   ` Jan Kara
2022-09-26 10:25     ` Yu Kuai
2022-09-26 11:47       ` Jan Kara [this message]
2022-09-26 13:01         ` Yu Kuai
2022-09-22 11:35 ` [PATCH v3 2/5] elevator: add new field flags in struct elevator_queue Yu Kuai
2022-09-22 11:35 ` [PATCH v3 3/5] block, bfq: don't disable wbt if CONFIG_BFQ_GROUP_IOSCHED is disabled Yu Kuai
2022-09-23  8:56   ` Christoph Hellwig
2022-09-23  9:50     ` Yu Kuai
2022-09-23 10:06       ` Jan Kara
2022-09-23 10:23         ` Yu Kuai
2022-09-23 11:03           ` Jan Kara
2022-09-23 11:32             ` Yu Kuai
2022-09-26 13:00             ` Yu Kuai
2022-09-26 14:22               ` Jan Kara
2022-09-27  1:02                 ` Yu Kuai
2022-09-27 16:14                   ` Paolo Valente
2022-09-28  3:30                     ` Yu Kuai
2022-09-22 11:35 ` [PATCH v3 4/5] blk-wbt: don't enable throttling if default elevator is bfq Yu Kuai
2022-09-22 11:35 ` [PATCH v3 5/5] elevator: remove redundant code in elv_unregister_queue() Yu Kuai
2022-09-23  3:37   ` Eric Biggers
2022-09-23  8:53   ` 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=20220926114726.ta2w3vcbxgkh3sov@quack3 \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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