HomeFreeBSD

pctrie: change for vm_radix compatibility

Description

pctrie: change for vm_radix compatibility

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.

  1. Offer a version of remove that does not panic and returns the freed

value (or NULL).

  1. 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

Details

Provenance
dougmAuthored on Aug 21 2023, 5:28 PM
Reviewer
kib
Differential Revision
D41396: pctrie: change for vm_radix compatibility
Parents
rG2c135a2aecdb: e6000sw: support building without FDT
Branches
Unknown
Tags
Unknown