RE: [v3 PATCH 9/9] rhashtable: Add immediate rehash during insertion
From: David Laight <hidden>
Date: 2015-03-23 16:56:03
From: Thomas Graf
On 03/24/15 at 12:50am, Herbert Xu wrote:quoted
@@ -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
@@ -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 swapping2nd: 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.
Or set the value to MAXINT to disable it. That way you don't even need two tests in the code. David