]> git.baikalelectronics.ru Git - kernel.git/commit
rhashtable: Use a single bucket lock for sibling buckets
authorThomas Graf <tgraf@suug.ch>
Thu, 5 Feb 2015 01:03:32 +0000 (02:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Feb 2015 23:18:34 +0000 (15:18 -0800)
commit03898cd6cd6b8c630319fca6d5c7b910d75b8508
treed9229fd3b7fd4b3321dded59e7bb4b8925e37cc9
parent8c50141e0d5dbabd58be445f3391307497a38cc7
rhashtable: Use a single bucket lock for sibling buckets

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: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/rhashtable.c