Skip to content

Commit

Permalink
pctrie: change for vm_radix compatibility
Browse files Browse the repository at this point in the history
Restructure parts of pctrie code to make it more compatible with the
needs of vm_radix code.

1. End passing function pointers for memory management.

By breaking insertion into two functions, the call for allocating
memory can happen at the top level and be inlined, rather than
happening via an function pointer to a memory allocator.

By changing the remove function slightly, freeing of memory, when
necessary, can happen at the top level and be inlined.

By turning the reclamation code into two functions, one for starting
iteration over to-be-freed nodes and the other continuing it, all the
freeing can happen at the top level and be inlined.

2. Offer a version of remove that does not panic and returns the freed
value (or NULL).
3. Offer a 'replace' operation, to replace one leaf with another that
has the same key.

These are three of the roadblocks that prevent code sharing between
pctrie and vm_radix code.

Reviewed by:	kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D41396
  • Loading branch information
Doug Moore authored and Doug Moore committed Aug 21, 2023
1 parent 2c135a2 commit 3b7ffac
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 141 deletions.
Loading

0 comments on commit 3b7ffac

Please sign in to comment.