> On Oct 16, 2018, at 1:00 PM, Mindaugas Rasiukevicius <rm...@netbsd.org> wrote:
>
> Hi,
>
> I recently implemented thmap [1] -- a concurrent trie-hash map, combining
> the elements of hashing and radix trie. It is supports lock-free lookups
> and concurrent inserts/deletes. It is designed to be optimal as a general
> purpose *concurrent* associative array [2][3].
I think this is a great thing to add to kern/ as a general facility. There are
applications beyond just the network stack, as well -- any read-mostly hash
table that has a lock or an array-of-locks around it is a good candidate for
being replaced by this.
We already have some objects in the kernel that use the "get-ref" / "put-ref"
pattern for indicating they are being referenced; this is ideal for hooking in
your G/C mechanism. We should probably, as a separate exercise, extend that
pattern to most of the objects managed in our kernel (even if the put-ref is a
no-op).
-- thorpej