[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACGdZYLFkNs7uOuq+ftSE7oMGNbB19nm40E86xiagCFfLZ1P0w@mail.gmail.com>
Date: Wed, 4 Oct 2023 13:30:44 -0700
From: Khazhy Kumykov <khazhy@...omium.org>
To: Tejun Heo <tj@...nel.org>
Cc: linan666@...weicloud.com, josef@...icpanda.com, axboe@...nel.dk,
yukuai3@...wei.com, cgroups@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linan122@...wei.com, yi.zhang@...wei.com, houtao1@...wei.com,
yangerkun@...wei.com
Subject: Re: [PATCH] blk-throttle: Calculate allowed value only when the
throttle is enabled
On Wed, Oct 4, 2023 at 12:32 PM Tejun Heo <tj@...nel.org> wrote:
>
> Hello,
>
> On Thu, Sep 28, 2023 at 09:58:58AM +0800, linan666@...weicloud.com wrote:
> > From: Li Nan <linan122@...wei.com>
> >
> > When the throttle of bps is not enabled, tg_bps_limit() returns U64_MAX,
> > which is be used in calculate_bytes_allowed(), and divide 0 error will
> > happen.
>
> calculate_bytes_allowed() is just
>
> return mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed, (u64)HZ);
>
> The only division is by HZ. How does divide by 0 happen?
We've also noticed this - haven't looked too deeply but I don't think
it's a divide by zero, but an overflow (bps_limit * jiffy_elapsed / HZ
will overflow for jiffies > HZ). mul_u64_u64_div_u64 does say it will
throw DE if the mul overflows
>
> Thanks.
>
> --
> tejun
Powered by blists - more mailing lists