• Thomas Graf's avatar
    rhashtable: Use a single bucket lock for sibling buckets · a5ec68e3
    Thomas Graf authored
    rhashtable currently allows to use a bucket lock per bucket. This
    requires multiple levels of complicated nested locking because when
    resizing, a single bucket of the smaller table will map to two
    buckets in the larger table. So far rhashtable has explicitly locked
    both buckets in the larger table.
    
    By excluding the highest bit of the hash from the bucket lock map and
    thus only allowing locks to buckets in a ratio of 1:2, the locking
    can be simplified a lot without losing the benefits of multiple locks.
    Larger tables which benefit from multiple locks will not have a single
    lock per bucket anyway.
    Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    a5ec68e3
rhashtable.c 28.6 KB