rculfhash: use threshold and target
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Jul 2011 04:44:43 +0000 (00:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 6 Jul 2011 04:44:43 +0000 (00:44 -0400)
Accept to target bucket len greater than 1 to diminish the memory
consumption without too much performance impact.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rculfhash.c

index 497a9eacdebd764771d1e6e2e88a95c019f83724..450b286385ab2e00db0116e78326dbb6d0c74521 100644 (file)
@@ -46,7 +46,8 @@
 #define dbg_printf(args...)
 #endif
 
-#define BUCKET_SIZE_RESIZE_THRESHOLD   4
+#define CHAIN_LEN_TARGET               4
+#define CHAIN_LEN_RESIZE_THRESHOLD     16
 
 #ifndef max
 #define max(a, b)      ((a) > (b) ? (a) : (b))
@@ -165,8 +166,9 @@ static
 void check_resize(struct rcu_ht *ht, struct rcu_table *t,
                  uint32_t chain_len)
 {
-       if (chain_len >= BUCKET_SIZE_RESIZE_THRESHOLD)
-               ht_resize_lazy(ht, t, log2_u32(chain_len));
+       if (chain_len >= CHAIN_LEN_RESIZE_THRESHOLD)
+               ht_resize_lazy(ht, t,
+                       log2_u32(chain_len - CHAIN_LEN_TARGET));
 }
 
 static
This page took 0.026301 seconds and 4 git commands to generate.