• Daniel Borkmann's avatar
    rhashtable: don't test for shrink on insert, expansion on delete · 342100d9
    Daniel Borkmann authored
    Restore pre 54c5b7d3 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: 54c5b7d3 ("rhashtable: introduce rhashtable_wakeup_worker helper function")
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Cc: Ying Xue <ying.xue@windriver.com>
    Acked-by: default avatarThomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    342100d9
rhashtable.c 30.8 KB