[lkml]   [2012]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 02/16] user_ns: use new hashtable implementation
On 08/15/2012 01:52 AM, Eric W. Biederman wrote:
> Sasha Levin <> writes:
>> Switch user_ns to use the new hashtable implementation. This reduces the amount of
>> generic unrelated code in user_ns.
> Two concerns here.
> 1) When adding a new entry you recompute the hash where previously that
> was not done. I believe that will slow down adding of new entries.

I figured that the price for the extra hashing isn't significant since hash_32
is just a multiplication and a shift.

I'll modify the code to calculate the key just once.

> 2) Using hash_32 for uids is an interesting choice. hash_32 discards
> the low bits. Last I checked for uids the low bits were the bits
> that were most likely to be different and had the most entropy.
> I'm not certain how multiplying by the GOLDEN_RATION_PRIME_32 will
> affect things but I would be surprised if it shifted all of the
> randomness from the low bits to the high bits.

"Is hash_* good enough for our purpose?" - I was actually surprised that no one
raised that question during the RFC and assumed it was because everybody agreed
that it's indeed good enough.

I can offer the following: I'll write a small module that will hash 1...10000
into a hashtable which uses 7 bits (just like user_ns) and post the distribution
we'll get.

If the results of the above will be satisfactory we can avoid the discussion
about which hash function we should really be using. If not, I guess now is a
good time for that :)

 \ /
  Last update: 2012-08-15 03:23    [W:0.193 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site