From: Joe Perches <joe@perches.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH net-next 1/2] net: introduce generic net_random_N helper
Date: Tue, 03 Sep 2013 05:41:57 -0700 [thread overview]
Message-ID: <1378212117.2048.29.camel@joe-AO722> (raw)
In-Reply-To: <5225D583.9090404@redhat.com>
On Tue, 2013-09-03 at 14:26 +0200, Daniel Borkmann wrote:
> On 09/03/2013 02:15 PM, Joe Perches wrote:
> > I think #define net_random() prandom_u32()
> > should be removed eventually as well.
>
> Why? Assume there could be different PRNGs in future that have different properties
> (e.g. speed vs. period, etc). Then, changing net_random() to something else is way
> easier and less error-prone than searching through the whole subtree of net and
> replacing every occurrence of prandom_u32().
Maybe. There are already instances of prandom_u32
in the net tree. I don't find value in the indirection.
Akinobu Mita once posted a s/net_random/prandom_u32/
patch: https://lkml.org/lkml/2012/12/23/140
> > If gcc doesn't already do this optimization,
> > perhaps there are also some use of
> > net_random() % non_const
> > that could be optimized a bit using this API.
>
> I agree with you, needs to be evaluated on a case by case basis for future work.
__builtin_constant_p is useful.
next prev parent reply other threads:[~2013-09-03 12:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 10:26 [PATCH net-next 0/2] net_random_N, reciprocal_divide helper updates Daniel Borkmann
2013-09-03 10:26 ` [PATCH net-next 1/2] net: introduce generic net_random_N helper Daniel Borkmann
2013-09-03 11:00 ` Joe Perches
2013-09-03 11:40 ` Daniel Borkmann
2013-09-03 12:15 ` Joe Perches
2013-09-03 12:26 ` Daniel Borkmann
2013-09-03 12:41 ` Joe Perches [this message]
2013-09-03 13:59 ` Eric Dumazet
2013-09-03 10:26 ` [PATCH net-next 2/2] net: use reciprocal_divide instead of reimplementing it Daniel Borkmann
2013-09-03 14:02 ` Eric Dumazet
2013-09-03 14:35 ` Daniel Borkmann
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=1378212117.2048.29.camel@joe-AO722 \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tytso@mit.edu \
/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).