From: Mathieu Desnoyers Date: Wed, 6 Jul 2011 04:44:43 +0000 (-0400) Subject: rculfhash: use threshold and target X-Git-Tag: v0.7.0~43^2~228 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3390d4701e9fec1df68bbfff42cca215b4bfee05;p=urcu.git rculfhash: use threshold and target Accept to target bucket len greater than 1 to diminish the memory consumption without too much performance impact. Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index 497a9ea..450b286 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -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