From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Daniel Borkmann <dborkman@redhat.com>,
davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Austin S Hemmelgarn <ahferroin7@gmail.com>,
Jesse Gross <jesse@nicira.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Matt Mackall <mpm@selenic.com>, Pekka Enberg <penberg@kernel.org>,
Christoph Lameter <cl@linux-foundation.org>,
Andy Gospodarek <andy@greyhouse.net>,
Veaceslav Falico <vfalico@redhat.com>,
Jay Vosburgh <fubar@us.ibm.com>,
Jakub Zawadzki <darkjames-ws@darkjames.pl>
Subject: Re: [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm
Date: Thu, 16 Jan 2014 11:26:18 +0100 [thread overview]
Message-ID: <20140116102618.GA7436@order.stressinduktion.org> (raw)
In-Reply-To: <1389841646.31367.391.camel@edumazet-glaptop2.roam.corp.google.com>
Hi Eric!
On Wed, Jan 15, 2014 at 07:07:26PM -0800, Eric Dumazet wrote:
> On Thu, 2014-01-16 at 00:23 +0100, Daniel Borkmann wrote:
>
> > Also, reciprocal_value() and reciprocal_divide() always return 0
> > for divisions by 1. This is a bit worrisome as those functions
> > also get used in mm/slab.c and lib/flex_array.c, apparently for
> > index calculation to access array slots.
>
> Hi Daniel
>
> This off-by-one limitation is a known one,
> and mm/slab.c does not have an issue with it because :
>
> - Minimal object size is not 1 byte, but 8 (or maybe 4)
> - We always divide a multiple of the divisor,
> so there is no off-by-one effect.
>
> Little attached prog does a brute force check if needed.
>
> So far, the only relevant issue was about BPF, and a better
> documentation of reciprocal_divide() use cases.
>
> (I let Jesse comment on the flex_array case)
>
> I am unsure we want to 'fix' things, we tried hard in the past to avoid
> divides, so the ones we use are usually because the divisor is not
> constant, so the reciprocal doesn't help.
>
> (BPF is fixed in David tree)
>
> Thanks !
You are right, we rewrite that part. The text is still from the first commit
message where we did no full impact analysis. ;)
Thanks,
Hannes
next prev parent reply other threads:[~2014-01-16 10:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 23:23 [PATCH net-next 0/2] reciprocal_divide updates Daniel Borkmann
2014-01-15 23:23 ` [PATCH net-next 1/2] random32: add prandom_u32_lt_N and convert "misuses" of reciprocal_divide Daniel Borkmann
2014-01-16 0:29 ` Joe Perches
2014-01-16 9:22 ` Daniel Borkmann
2014-01-16 3:14 ` Eric Dumazet
2014-01-16 9:28 ` David Laight
2014-01-16 9:30 ` Daniel Borkmann
2014-01-15 23:23 ` [PATCH net-next 2/2] reciprocal_divide: correction/update of the algorithm Daniel Borkmann
2014-01-16 0:17 ` Ben Hutchings
2014-01-16 0:46 ` Hannes Frederic Sowa
2014-01-16 3:07 ` Eric Dumazet
2014-01-16 10:26 ` Hannes Frederic Sowa [this message]
2014-01-16 16:37 ` Christoph Lameter
2014-01-16 17:24 ` Hannes Frederic Sowa
2014-01-17 10:05 ` David Laight
2014-01-16 18:50 ` Ben Hutchings
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=20140116102618.GA7436@order.stressinduktion.org \
--to=hannes@stressinduktion.org \
--cc=ahferroin7@gmail.com \
--cc=andy@greyhouse.net \
--cc=cl@linux-foundation.org \
--cc=darkjames-ws@darkjames.pl \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=fubar@us.ibm.com \
--cc=jesse@nicira.com \
--cc=jhs@mojatatu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=penberg@kernel.org \
--cc=stephen@networkplumber.org \
--cc=vfalico@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;
as well as URLs for NNTP newsgroup(s).