[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1378212117.2048.29.camel@joe-AO722>
Date: Tue, 03 Sep 2013 05:41:57 -0700
From: Joe Perches <joe@...ches.com>
To: Daniel Borkmann <dborkman@...hat.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org,
Theodore Ts'o <tytso@....edu>
Subject: Re: [PATCH net-next 1/2] net: introduce generic net_random_N helper
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists