dm: improve hash_locks sizing and hash function
authorJoe Thornber <ejt@redhat.com>
Wed, 29 Mar 2023 14:29:34 +0000 (10:29 -0400)
committerMike Snitzer <snitzer@kernel.org>
Thu, 30 Mar 2023 19:57:51 +0000 (15:57 -0400)
commit363b7fd76c91dc611a56d992e9550bb1ba070e1a
treea8871fafe3b50344d8ff12a4fc7403cfdfd9772a
parentb6279f82eb11a1f380af3a26acf921c37505fc86
dm: improve hash_locks sizing and hash function

Both bufio and bio-prison-v1 use the identical model for splitting
their respective locks and rbtrees. Improve dm_num_hash_locks() to
distribute across more rbtrees to improve overall performance -- but
the maximum number of locks/rbtrees is still 64.

Also factor out a common hash function named dm_hash_locks_index(),
the magic numbers used were determined to be best using this program:
 https://gist.github.com/jthornber/e05c47daa7b500c56dc339269c5467fc

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-bio-prison-v1.c
drivers/md/dm-bufio.c
drivers/md/dm.h