[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160502132804.GF12845@twins.programming.kicks-ass.net>
Date: Mon, 2 May 2016 15:28:04 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: George Spelvin <linux@...izon.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de,
torvalds@...ux-foundation.org, bfields@...ldses.org,
eric.dumazet@...il.com, jlayton@...chiereds.net,
linux-nfs@...r.kernel.org, riel@...hat.com
Subject: Re: [PATCH 1/2] <linux/hash.h>: Make hash_64(), hash_ptr() return 32
bits
On Mon, May 02, 2016 at 06:20:16AM -0400, George Spelvin wrote:
> Subject: [PATCH 1/2] <linux/hash.h>: Make hash_64(), hash_ptr() return 32 bits
> +static __always_inline u64 hash_64(u64 val, unsigned bits)
> +{
> /* High bits are more random, so use them. */
> + return __hash_64(val) >> (64 - bits);
> }
Is the subject stale or the above a mistake? Because hash_64() still
very much seems to return u64.
Also, I think I would prefer to keep it like this, I would like to use
it for kernel/locking/lockdep.c:iterate_chain_key(), which currently is
a somewhat crap hash.
Something like:
static inline u64 iterate_chain_key(u64 key1, u64 key2)
{
return hash_64(key1 ^ key2, 64);
}
Powered by blists - more mailing lists