From: Oleg Nesterov <oleg@redhat.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Brian Behlendorf <behlendorf1@llnl.gov>,
Siarhei Volkau <lis8215@gmail.com>
Subject: Re: [PATCH] lib/div64: off by one in shift
Date: Mon, 28 Jan 2019 18:35:09 +0100 [thread overview]
Message-ID: <20190128173508.GD22143@redhat.com> (raw)
In-Reply-To: <1548686944-11891-1-git-send-email-sgruszka@redhat.com>
On 01/28, Stanislaw Gruszka wrote:
>
> fls counts bits starting from 1 to 32 (returns 0 for zero argument).
> If we add 1 we shift right one bit more and loose precision
I forgot everything about this code, but I think this patch must be correct,
divisor >> n;
should have MSB == 1 or we loose the precision... Heh, I managed to find the
initial version of this code, see
https://lore.kernel.org/lkml/20101014121159.GA407@redhat.com/
and note that it uses __fls(), not fls()! I didn't notice the final version
replaced __fls() with fls() which is __fls() + 1 if arg != 0.
Acked-by: Oleg Nesterov <oleg@redhat.com>
next prev parent reply other threads:[~2019-01-28 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 14:49 [PATCH] lib/div64: off by one in shift Stanislaw Gruszka
2019-01-28 17:35 ` Oleg Nesterov [this message]
2019-01-28 17:45 ` Andrew Morton
2019-01-29 15:21 ` Stanislaw Gruszka
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=20190128173508.GD22143@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=behlendorf1@llnl.gov \
--cc=linux-kernel@vger.kernel.org \
--cc=lis8215@gmail.com \
--cc=sgruszka@redhat.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