Whamcloud - gitweb
LU-12678 socklnd: convert peers hash table to hashtable.h 37/36837/6
authorMr NeilBrown <neilb@suse.de>
Wed, 15 Jan 2020 15:36:42 +0000 (10:36 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Feb 2020 08:10:30 +0000 (08:10 +0000)
commitdbbcf61d2bdcf62740c1d5c8debaeb6afdfc2261
treea680a6eaf480b491fb0cd242bfc875768b1b2bf7
parent97301a491d46cf2cf829185b52b8690287ab7ed6
LU-12678 socklnd: convert peers hash table to hashtable.h

Using a hashtable.h hashtable, rather than bespoke code, has several
advantages:

 - the table is comprised of hlist_head, rather than list_head, so
   it consumes less memory (though we need to make it a little bigger
   as it must be a power-of-2)
 - there are existing macros for easily walking the whole table
 - it uses a "real" hash function rather than "mod a prime number".

In some ways, rhashtable might be even better, but it can change the
ordering of objects in the table at arbitrary moments, and that could
hurt the user-space API.  It also does not support the partitioned
walking that ksocknal_check_peer_timeouts() depends on.

Note that new peers are inserted at the top of a hash chain, rather
than appended at the end.  I don't think that should be a problem.

Test-Parameters: trivial testlist=sanity-lnet

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I70fe64df0dd0db73666ff6fb2d2888b1d64f4be5
Reviewed-on: https://review.whamcloud.com/36837
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_cb.c