Re: [v3 PATCH 9/9] rhashtable: Add immediate rehash during insertion
From: Thomas Graf <tgraf@suug.ch>
Date: 2015-03-23 16:50:34
On 03/24/15 at 12:50am, Herbert Xu wrote:
quoted hunk ↗ jump to hunk
@@ -116,6 +117,7 @@ struct rhashtable_params { unsigned int max_size; unsigned int min_size; u32 nulls_base; + bool insecure_elasticity; size_t locks_mul; rht_hashfn_t hashfn; rht_obj_hashfn_t obj_hashfn;
First of all, love the naming of this variable ;-)
quoted hunk ↗ jump to hunk
@@ -127,6 +129,7 @@ struct rhashtable_params { * @tbl: Bucket table * @nelems: Number of elements in table * @key_len: Key length for hashfn + * @elasticity: Maximum chain length before rehash * @p: Configuration parameters * @run_work: Deferred worker to expand/shrink asynchronously * @mutex: Mutex to protect current/future table swapping
2nd: Seems like you rely on an underflow to allow to "disable" the elasticity limit. Fair enough, but it would be great to have the limit configurable as well. How about making elasticity a signed int, default to 16 if user specifies 0 and require it to be set to -1 (through a define) to actually disable the behaviour. That would avoid requiring two variables to implement this and makes the limit configurable at the same time. Otherwise this looks good to me.