From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk,
cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH 2/2] blk-throttle: fix off-by-one jiffies wait_time
Date: Tue, 25 Feb 2025 20:00:03 +0800 [thread overview]
Message-ID: <Z72ww9f8MCSqiTy0@fedora> (raw)
In-Reply-To: <dc2b3a40-b33b-0bc5-3a73-18b288b4283f@huaweicloud.com>
On Tue, Feb 25, 2025 at 07:09:30PM +0800, Yu Kuai wrote:
> Hi,
>
> 在 2025/02/25 16:21, Ming Lei 写道:
> > On Tue, Feb 25, 2025 at 11:12:24AM +0800, Yu Kuai wrote:
> > > Hi, Ming!
> > >
> > > 在 2025/02/25 10:28, Ming Lei 写道:
> > > > Can you explain in details why it signals that the rate is expected now?
> > > >
> > > > If rate isn't expected, it will cause trouble to trim, even just the
> > > > previous part.
> > >
> > > Ok, for example, assume bps_limit is 1000bytes, 1 jiffes is 10ms, and
> > > slice is 20ms(2 jiffies).
> > >
> >
> > We all know how it works, but I didn't understand the behind idea why it
> > is correct. Now I figured it out:
> >
> > 1) increase default slice window to 2 * td->throttle_slice
> >
> > 2) slice window is set as [jiffies - td->throttle_slice, jiffies + td->throttle_slice]
> >
> > 3) initialize td->bytes_disp[]/td->io_dis[] as actual dispatched bytes/ios
> > done [jiffies - td->throttle_slice, 0]
> >
> > This approach looks smart, and it should work well for any deviation which is <= 1
> > throttle_slice.
> >
> > Probably it is enough for fixing the issue in throtl/001, even though 2 jiffies
> > timer drift still may be observed, see the below log collected in my VM(HZ_100)
> > by just running one time of blktests './check throtl':
> >
> > @timer_expire_delay:
> > [1, 2) 387 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
> > [2, 3) 11 |@ |
> >
> > bpftrace -e 'kfunc:throtl_pending_timer_fn { @timer_expire_delay = lhist(jiffies - args->t->expires, 0, 16, 1);}'
> >
> >
> > Also I'd suggest to remove ->carryover_bytes/ios since blk-throttle algorithm is
> > supposed to be adaptive, and the approach I suggested may cover this area,
> > what do you think of this cleanup? I have one local patchset, which can
> > pass all blktest throtl tests with removing ->carryover_bytes/ios.
> >
>
> It's always welcome for such cleanup. BTW, do you have plans to support
> bio merge for iops limit in blk-throttle?
> Since bio split is handled. I
> was thinking about using carryover_ios, perhaps you can handle this as
> well.
I don't know the two problems.
Let's focus on fixing throtl/001 first.
I raised the cleanup on carryover_ios because the fix I proposed in [1]
may help to cover carryover_ios too.
But I guess your patch of doubling splice window is better for fixing
throtl/001, can you send a formal patch with comment for fixing this
issue first?
[1] https://lore.kernel.org/linux-block/Z7nAJSKGANoC0Glb@fedora/
Thanks,
Ming
next prev parent reply other threads:[~2025-02-25 12:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 9:28 [PATCH 0/2] blk-throttle: fix off-by-one jiffies wait_time Yu Kuai
2025-02-22 9:28 ` [PATCH 1/2] blk-throttle: cleanup throtl_extend_slice() Yu Kuai
2025-02-25 20:30 ` Tejun Heo
2025-02-22 9:28 ` [PATCH 2/2] blk-throttle: fix off-by-one jiffies wait_time Yu Kuai
2025-02-22 12:16 ` Ming Lei
2025-02-24 2:39 ` Yu Kuai
2025-02-24 3:28 ` Ming Lei
2025-02-24 7:03 ` Yu Kuai
2025-02-24 8:56 ` Ming Lei
2025-02-24 12:03 ` Yu Kuai
2025-02-25 1:24 ` Ming Lei
2025-02-25 2:07 ` Yu Kuai
2025-02-25 2:28 ` Ming Lei
2025-02-25 3:12 ` Yu Kuai
2025-02-25 8:21 ` Ming Lei
2025-02-25 11:09 ` Yu Kuai
2025-02-25 12:00 ` Ming Lei [this message]
2025-02-25 10:51 ` [PATCH 0/2] " Michal Koutný
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=Z72ww9f8MCSqiTy0@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yangerkun@huawei.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.