aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-12-10 10:33:11 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-10 15:17:45 -0500
commit87545899b52f9c8b1621be4347f443890c0cb196 (patch)
tree6c831c9730701053c09acbcb537abac899909516 /lib/rhashtable.c
parent7f19fc5e0b617593dcda0d9956adc78b559ef1f5 (diff)
net: replace remaining users of arch_fast_hash with jhash
This patch effectively reverts commit 500f80872645 ("net: ovs: use CRC32 accelerated flow hash if available"), and other remaining arch_fast_hash() users such as from nfsd via commit 6282cd565553 ("NFSD: Don't hand out delegations for 30 seconds after recalling them.") where it has been used as a hash function for bloom filtering. While we think that these users are actually not much of concern, it has been requested to remove the arch_fast_hash() library bits that arose from [1] entirely as per recent discussion [2]. The main argument is that using it as a hash may introduce bias due to its linearity (see avalanche criterion) and thus makes it less clear (though we tried to document that) when this security/performance trade-off is actually acceptable for a general purpose library function. Lets therefore avoid any further confusion on this matter and remove it to prevent any future accidental misuse of it. For the time being, this is going to make hashing of flow keys a bit more expensive in the ovs case, but future work could reevaluate a different hashing discipline. [1] https://patchwork.ozlabs.org/patch/299369/ [2] https://patchwork.ozlabs.org/patch/418756/ Cc: Neil Brown <neilb@suse.de> Cc: Francesco Fusco <fusco@ntop.org> Cc: Jesse Gross <jesse@nicira.com> Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index c7e987ab3361..6c3c723e902b 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -20,7 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/hash.h> 23#include <linux/jhash.h>
24#include <linux/random.h> 24#include <linux/random.h>
25#include <linux/rhashtable.h> 25#include <linux/rhashtable.h>
26 26
@@ -524,7 +524,7 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params)
524 * .head_offset = offsetof(struct test_obj, node), 524 * .head_offset = offsetof(struct test_obj, node),
525 * .key_offset = offsetof(struct test_obj, key), 525 * .key_offset = offsetof(struct test_obj, key),
526 * .key_len = sizeof(int), 526 * .key_len = sizeof(int),
527 * .hashfn = arch_fast_hash, 527 * .hashfn = jhash,
528 * #ifdef CONFIG_PROVE_LOCKING 528 * #ifdef CONFIG_PROVE_LOCKING
529 * .mutex_is_held = &my_mutex_is_held, 529 * .mutex_is_held = &my_mutex_is_held,
530 * #endif 530 * #endif
@@ -545,7 +545,7 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params)
545 * 545 *
546 * struct rhashtable_params params = { 546 * struct rhashtable_params params = {
547 * .head_offset = offsetof(struct test_obj, node), 547 * .head_offset = offsetof(struct test_obj, node),
548 * .hashfn = arch_fast_hash, 548 * .hashfn = jhash,
549 * .obj_hashfn = my_hash_fn, 549 * .obj_hashfn = my_hash_fn,
550 * #ifdef CONFIG_PROVE_LOCKING 550 * #ifdef CONFIG_PROVE_LOCKING
551 * .mutex_is_held = &my_mutex_is_held, 551 * .mutex_is_held = &my_mutex_is_held,
@@ -778,7 +778,7 @@ static int __init test_rht_init(void)
778 .head_offset = offsetof(struct test_obj, node), 778 .head_offset = offsetof(struct test_obj, node),
779 .key_offset = offsetof(struct test_obj, value), 779 .key_offset = offsetof(struct test_obj, value),
780 .key_len = sizeof(int), 780 .key_len = sizeof(int),
781 .hashfn = arch_fast_hash, 781 .hashfn = jhash,
782#ifdef CONFIG_PROVE_LOCKING 782#ifdef CONFIG_PROVE_LOCKING
783 .mutex_is_held = &test_mutex_is_held, 783 .mutex_is_held = &test_mutex_is_held,
784#endif 784#endif