[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190128173508.GD22143@redhat.com>
Date: Mon, 28 Jan 2019 18:35:09 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Stanislaw Gruszka <sgruszka@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Brian Behlendorf <behlendorf1@...l.gov>,
Siarhei Volkau <lis8215@...il.com>
Subject: Re: [PATCH] lib/div64: off by one in shift
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@...hat.com>
Powered by blists - more mailing lists