]> git.baikalelectronics.ru Git - kernel.git/commit
rhashtable: don't test for shrink on insert, expansion on delete
authorDaniel Borkmann <daniel@iogearbox.net>
Thu, 19 Feb 2015 23:53:37 +0000 (00:53 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Feb 2015 22:38:09 +0000 (17:38 -0500)
commit7a105662e06ec83037dafbc9076d13da604aca55
tree4d3f668296689371fb6825344cfa02faf40cc5be
parent8b6e1b37c8b0bd6322613d34689ee7c62be9010f
rhashtable: don't test for shrink on insert, expansion on delete

Restore pre 20de12991218 behaviour and only probe for expansions on inserts
and shrinks on deletes. Currently, it will happen that on initial inserts
into a sparse hash table, we may i.e. shrink it first simply because it's
not fully populated yet, only to later realize that we need to grow again.

This however is counter intuitive, e.g. an initial default size of 64
elements is already small enough, and in case an elements size hint is given
to the hash table by a user, we should avoid unnecessary expansion steps,
so a shrink is clearly unintended here.

Fixes: 20de12991218 ("rhashtable: introduce rhashtable_wakeup_worker helper function")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Ying Xue <ying.xue@windriver.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c