* [PATCH v2 0/3] Optimize wbt and update its comments and doc
@ 2025-07-27 16:47 Tang Yizhou
2025-07-27 16:47 ` [PATCH v2 1/3] blk-wbt: Optimize wbt_done() for non-throttled writes Tang Yizhou
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Tang Yizhou @ 2025-07-27 16:47 UTC (permalink / raw)
To: axboe, hch, jack; +Cc: linux-block, linux-kernel, tangyeechou, Tang Yizhou
From: Tang Yizhou <yizhou.tang@shopee.com>
Some minor optimizations and updates of comments and doc for wbt.
v2:
Patch #1: Pick up Jan and Kuai's Reviewed-by tag.
Patch #2: Pick up Jan's Reviewed-by tag.
Patch #3: Take Jan and Kuai's advice. Change the name to
'curr_win_nsec'.
Tang Yizhou (3):
blk-wbt: Optimize wbt_done() for non-throttled writes
blk-wbt: Eliminate ambiguity in the comments of struct rq_wb
blk-wbt: doc: Update the doc of the wbt_lat_usec interface
Documentation/ABI/stable/sysfs-block | 2 +-
block/blk-wbt.c | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/3] blk-wbt: Optimize wbt_done() for non-throttled writes 2025-07-27 16:47 [PATCH v2 0/3] Optimize wbt and update its comments and doc Tang Yizhou @ 2025-07-27 16:47 ` Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 2/3] blk-wbt: Eliminate ambiguity in the comments of struct rq_wb Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface Tang Yizhou 2 siblings, 0 replies; 6+ messages in thread From: Tang Yizhou @ 2025-07-27 16:47 UTC (permalink / raw) To: axboe, hch, jack Cc: linux-block, linux-kernel, tangyeechou, Tang Yizhou, Yu Kuai From: Tang Yizhou <yizhou.tang@shopee.com> In the current implementation, the sync_cookie and last_cookie members of struct rq_wb are used only by read requests and not by non-throttled write requests. Based on this, we can optimize wbt_done() by removing one if condition check for non-throttled write requests. Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Yu Kuai <yukuai3@huawei.com> --- block/blk-wbt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index a50d4cd55f41..30886d44f6cd 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -248,13 +248,14 @@ static void wbt_done(struct rq_qos *rqos, struct request *rq) struct rq_wb *rwb = RQWB(rqos); if (!wbt_is_tracked(rq)) { - if (rwb->sync_cookie == rq) { - rwb->sync_issue = 0; - rwb->sync_cookie = NULL; - } + if (wbt_is_read(rq)) { + if (rwb->sync_cookie == rq) { + rwb->sync_issue = 0; + rwb->sync_cookie = NULL; + } - if (wbt_is_read(rq)) wb_timestamp(rwb, &rwb->last_comp); + } } else { WARN_ON_ONCE(rq == rwb->sync_cookie); __wbt_done(rqos, wbt_flags(rq)); -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] blk-wbt: Eliminate ambiguity in the comments of struct rq_wb 2025-07-27 16:47 [PATCH v2 0/3] Optimize wbt and update its comments and doc Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 1/3] blk-wbt: Optimize wbt_done() for non-throttled writes Tang Yizhou @ 2025-07-27 16:47 ` Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface Tang Yizhou 2 siblings, 0 replies; 6+ messages in thread From: Tang Yizhou @ 2025-07-27 16:47 UTC (permalink / raw) To: axboe, hch, jack; +Cc: linux-block, linux-kernel, tangyeechou, Tang Yizhou From: Tang Yizhou <yizhou.tang@shopee.com> In the current implementation, the last_issue and last_comp members of struct rq_wb are used only by read requests and not by non-throttled write requests. Therefore, eliminate the ambiguity here. Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> Reviewed-by: Jan Kara <jack@suse.cz> --- block/blk-wbt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 30886d44f6cd..eb8037bae0bd 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -85,8 +85,8 @@ struct rq_wb { u64 sync_issue; void *sync_cookie; - unsigned long last_issue; /* last non-throttled issue */ - unsigned long last_comp; /* last non-throttled comp */ + unsigned long last_issue; /* issue time of last read rq */ + unsigned long last_comp; /* completion time of last read rq */ unsigned long min_lat_nsec; struct rq_qos rqos; struct rq_wait rq_wait[WBT_NUM_RWQ]; -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface 2025-07-27 16:47 [PATCH v2 0/3] Optimize wbt and update its comments and doc Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 1/3] blk-wbt: Optimize wbt_done() for non-throttled writes Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 2/3] blk-wbt: Eliminate ambiguity in the comments of struct rq_wb Tang Yizhou @ 2025-07-27 16:47 ` Tang Yizhou 2025-07-27 17:09 ` Yu Kuai 2 siblings, 1 reply; 6+ messages in thread From: Tang Yizhou @ 2025-07-27 16:47 UTC (permalink / raw) To: axboe, hch, jack; +Cc: linux-block, linux-kernel, tangyeechou, Tang Yizhou From: Tang Yizhou <yizhou.tang@shopee.com> The symbol wb_window_usec cannot be found. Update the doc to reflect the latest implementation, in other words, the cur_win_nsec member of struct rq_wb. Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> --- Documentation/ABI/stable/sysfs-block | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block index 4ba771b56b3b..277d89815edd 100644 --- a/Documentation/ABI/stable/sysfs-block +++ b/Documentation/ABI/stable/sysfs-block @@ -731,7 +731,7 @@ Contact: linux-block@vger.kernel.org Description: [RW] If the device is registered for writeback throttling, then this file shows the target minimum read latency. If this latency - is exceeded in a given window of time (see wb_window_usec), then + is exceeded in a given window of time (see cur_win_nsec), then the writeback throttling will start scaling back writes. Writing a value of '0' to this file disables the feature. Writing a value of '-1' to this file resets the value to the default -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface 2025-07-27 16:47 ` [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface Tang Yizhou @ 2025-07-27 17:09 ` Yu Kuai 2025-07-27 17:27 ` Yizhou Tang 0 siblings, 1 reply; 6+ messages in thread From: Yu Kuai @ 2025-07-27 17:09 UTC (permalink / raw) To: Tang Yizhou, axboe, hch, jack; +Cc: linux-block, linux-kernel, tangyeechou Hi, 在 2025/7/28 0:47, Tang Yizhou 写道: > From: Tang Yizhou <yizhou.tang@shopee.com> > > The symbol wb_window_usec cannot be found. Update the doc to reflect the > latest implementation, in other words, the cur_win_nsec member of struct > rq_wb. > > Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> > --- > Documentation/ABI/stable/sysfs-block | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block > index 4ba771b56b3b..277d89815edd 100644 > --- a/Documentation/ABI/stable/sysfs-block > +++ b/Documentation/ABI/stable/sysfs-block > @@ -731,7 +731,7 @@ Contact: linux-block@vger.kernel.org > Description: > [RW] If the device is registered for writeback throttling, then > this file shows the target minimum read latency. If this latency > - is exceeded in a given window of time (see wb_window_usec), then > + is exceeded in a given window of time (see cur_win_nsec), then Is this a typo? Jan suggested curr_win_nsec from v1. BTW, I don't mind rename rwb->cur_win_nsec to curr_win_nsec as well. Thanks, Kuai > the writeback throttling will start scaling back writes. Writing > a value of '0' to this file disables the feature. Writing a > value of '-1' to this file resets the value to the default ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface 2025-07-27 17:09 ` Yu Kuai @ 2025-07-27 17:27 ` Yizhou Tang 0 siblings, 0 replies; 6+ messages in thread From: Yizhou Tang @ 2025-07-27 17:27 UTC (permalink / raw) To: yukuai; +Cc: Tang Yizhou, axboe, hch, jack, linux-block, linux-kernel On Mon, Jul 28, 2025 at 1:09 AM Yu Kuai <yukuai@kernel.org> wrote: > > Hi, > > 在 2025/7/28 0:47, Tang Yizhou 写道: > > From: Tang Yizhou <yizhou.tang@shopee.com> > > > > The symbol wb_window_usec cannot be found. Update the doc to reflect the > > latest implementation, in other words, the cur_win_nsec member of struct > > rq_wb. > > > > Signed-off-by: Tang Yizhou <yizhou.tang@shopee.com> > > --- > > Documentation/ABI/stable/sysfs-block | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block > > index 4ba771b56b3b..277d89815edd 100644 > > --- a/Documentation/ABI/stable/sysfs-block > > +++ b/Documentation/ABI/stable/sysfs-block > > @@ -731,7 +731,7 @@ Contact: linux-block@vger.kernel.org > > Description: > > [RW] If the device is registered for writeback throttling, then > > this file shows the target minimum read latency. If this latency > > - is exceeded in a given window of time (see wb_window_usec), then > > + is exceeded in a given window of time (see cur_win_nsec), then > Is this a typo? Jan suggested curr_win_nsec from v1. > > BTW, I don't mind rename rwb->cur_win_nsec to curr_win_nsec as well. Sorry, that was indeed a typo. I checked the code, and now both cur_win_nsec and curr_win_nsec are used. The latter was introduced by Ming in commit d19afebca476 ("blk-wbt: export internal state via debugfs"). In the Linux kernel, both 'cur' and 'curr' are commonly used as abbreviations for 'current'. If we were to unify the naming, I suspect it could spark some debate. For now, I won’t pursue unified naming — in the next version of the patch, I’ll change it to curr_win_nsec. Thanks, Yi > > Thanks, > Kuai > > > the writeback throttling will start scaling back writes. Writing > > a value of '0' to this file disables the feature. Writing a > > value of '-1' to this file resets the value to the default > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-07-27 17:27 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-07-27 16:47 [PATCH v2 0/3] Optimize wbt and update its comments and doc Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 1/3] blk-wbt: Optimize wbt_done() for non-throttled writes Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 2/3] blk-wbt: Eliminate ambiguity in the comments of struct rq_wb Tang Yizhou 2025-07-27 16:47 ` [PATCH v2 3/3] blk-wbt: doc: Update the doc of the wbt_lat_usec interface Tang Yizhou 2025-07-27 17:09 ` Yu Kuai 2025-07-27 17:27 ` Yizhou Tang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox