rb_tree: let insert search start from next node
authorDoug Moore <dougm@FreeBSD.org>
Mon, 3 Oct 2022 03:27:21 +0000 (22:27 -0500)
committerDoug Moore <dougm@FreeBSD.org>
Mon, 3 Oct 2022 03:27:21 +0000 (22:27 -0500)
commit368ee2f86a0f4f60338472be4bfd3c09ab401f87
tree6c09c67e8aeff803f78941336bb819a6a41978aa
parenta7eac018437e592a575f46a59151eedc7a742fa7
rb_tree: let insert search start from next node

When the node to insert in the rb_tree is known to precede or follow a
particular node, new methods RB_INSERT_PREV and RB_INSERT_NEXT,
defined here, allow the search for where to insert the new node begin
with that particular node, rather than at the root, to save a bit of
time.

Using those methods, instead of RB_INSERT, in managing a tree in
iommu_gas.c, saves a little time.

Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35516
share/man/man3/tree.3
sys/dev/iommu/iommu_gas.c
sys/sys/tree.h