[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140609002825.20757.qmail@ns.horizon.com>
Date: 8 Jun 2014 20:28:25 -0400
From: "George Spelvin" <linux@...izon.com>
To: dborkman@...hat.com, hannes@...essinduktion.org
Cc: davem@...emloft.net, linux-kernel@...r.kernel.org,
linux@...izon.com, shemminger@...l.org, tytso@....edu
Subject: Re: [PATCH 5/7] lib/random32.c: Make prandom_u32_max efficient for powers of 2
Daniel Borkmann wrote:
> On 06/08/2014 07:34 PM, Hannes Frederic Sowa wrote:
>> Please check this as it makes the code more complicated and I doubt it is worth it.
>
> Agreed.
Just to clarify, the goal is to be able to replace "prandom_u32() %
range" all over the kernel with "prandom_u32_max(range)" and promise
people that it's guaranteed to be just as good.
My goal is a one-time cleanup to eliminate "prandom_u32() % range" so
people will stop cutting and pasting it into new code.
(FIXME: Add a kdoc update on the subject.)
It uglifies the random32 code for sure, but by encapsulating the cleverness
it lets all the call sites be simpler and reduces arguments about the change.
E.g. have a look at all the prandom_u32 calls in net/core/pktgen.c.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists