From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Andrey Ryabinin <aryabinin@odin.com>,
Wu Fengguang <fengguang.wu@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
Dmitry Vyukov <dvyukov@google.com>,
Sasha Levin <sasha.levin@oracle.com>
Subject: Re: undefined shift in wb_update_dirty_ratelimit()
Date: Sun, 13 Dec 2015 01:17:12 +0200 [thread overview]
Message-ID: <CAHp75VdHCSmw9tgd7ZC_n=N09wQHMHk8T5oK7jS7cM+zqBQ-_Q@mail.gmail.com> (raw)
In-Reply-To: <20151207142621.GA7012@mtj.duckdns.org>
On Mon, Dec 7, 2015 at 4:26 PM, Tejun Heo <tj@kernel.org> wrote:
> Hello, Andrey.
> On Mon, Dec 07, 2015 at 05:17:06PM +0300, Andrey Ryabinin wrote:
>> I've hit undefined shift in wb_update_dirty_ratelimit() which does some
>> mysterious 'step' calculations:
>>
>> /*
>> * Don't pursue 100% rate matching. It's impossible since the balanced
>> * rate itself is constantly fluctuating. So decrease the track speed
>> * when it gets close to the target. Helps eliminate pointless tremors.
>> */
>> step >>= dirty_ratelimit / (2 * step + 1);
>>
>>
>> dirty_ratelimit = INIT_BW and step = 0 results in this:
>>
>> [ 5006.957366] ================================================================================
>> [ 5006.957798] UBSAN: Undefined behaviour in ../mm/page-writeback.c:1286:7
>> [ 5006.958091] shift exponent 25600 is too large for 64-bit type 'long unsigned int'
>
> We prolly should do sth like
>
> shift = dirty_ratelimit / (2 * step = 1);
> if (shift < BITS_PER_LONG) {
> step = (step >> shift) + 7 / 8;
7/8 = 0. Missed parens?
In that case it's DIV_ROUND_UP(step >> shift, 8)
> } else {
> step = 0;
> }
--
With Best Regards,
Andy Shevchenko
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-12-12 23:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 14:17 Andrey Ryabinin
2015-12-07 14:26 ` Tejun Heo
2015-12-12 23:17 ` Andy Shevchenko [this message]
2016-01-25 14:11 ` [PATCH] mm/page-writeback: fix dirty_ratelimit calculation Andrey Ryabinin
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='CAHp75VdHCSmw9tgd7ZC_n=N09wQHMHk8T5oK7jS7cM+zqBQ-_Q@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@odin.com \
--cc=dvyukov@google.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sasha.levin@oracle.com \
--cc=tj@kernel.org \
/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