rhashtable: remove indirection for grow/shrink decision functions
Currently, all real users of rhashtable default their grow and shrink decision functions to rht_grow_above_75() and rht_shrink_below_30(), so that there's currently no need to have this explicitly selectable. It can/should be generic and private inside rhashtable until a real use case pops up. Since we can make this private, we'll save us this additional indirection layer and can improve insertion/deletion time as well. Reference: http://patchwork.ozlabs.org/patch/443040/ Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
8331de75cb
commit
4c4b52d9b2
@@ -79,12 +79,6 @@ struct rhashtable;
|
||||
* @locks_mul: Number of bucket locks to allocate per cpu (default: 128)
|
||||
* @hashfn: Function to hash key
|
||||
* @obj_hashfn: Function to hash object
|
||||
* @grow_decision: If defined, may return true if table should expand
|
||||
* @shrink_decision: If defined, may return true if table should shrink
|
||||
*
|
||||
* Note: when implementing the grow and shrink decision function, min/max
|
||||
* shift must be enforced, otherwise, resizing watermarks they set may be
|
||||
* useless.
|
||||
*/
|
||||
struct rhashtable_params {
|
||||
size_t nelem_hint;
|
||||
@@ -98,10 +92,6 @@ struct rhashtable_params {
|
||||
size_t locks_mul;
|
||||
rht_hashfn_t hashfn;
|
||||
rht_obj_hashfn_t obj_hashfn;
|
||||
bool (*grow_decision)(const struct rhashtable *ht,
|
||||
size_t new_size);
|
||||
bool (*shrink_decision)(const struct rhashtable *ht,
|
||||
size_t new_size);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -193,9 +183,6 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params);
|
||||
void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node);
|
||||
bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node);
|
||||
|
||||
bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size);
|
||||
bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size);
|
||||
|
||||
int rhashtable_expand(struct rhashtable *ht);
|
||||
int rhashtable_shrink(struct rhashtable *ht);
|
||||
|
||||
|
Reference in New Issue
Block a user