Page MenuHomeFreeBSD

Reorder manipulations in RB_REMOVE
ClosedPublic

Authored by dougm on May 15 2020, 5:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 7:13 AM
Unknown Object (File)
Mon, Oct 28, 7:08 AM
Unknown Object (File)
Oct 19 2024, 10:16 AM
Unknown Object (File)
Sep 27 2024, 1:24 PM
Unknown Object (File)
Sep 25 2024, 9:15 AM
Unknown Object (File)
Sep 17 2024, 3:32 PM
Unknown Object (File)
Sep 16 2024, 5:28 PM
Unknown Object (File)
Aug 19 2024, 3:38 AM
Subscribers

Details

Summary

For the case when RB_REMOVE requires a nontrivial search to find the node to replace the one being removed, restructure to remove the replacement node, and correct the parent pointers around it first, and let the all-cases code at the end deal with the parent of deleted node, making it point to the replacement node. This removes one or two conditional branches.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.May 15 2020, 5:27 AM
dougm created this revision.
markj added inline comments.
sys/sys/tree.h
597 ↗(On Diff #71808)

Perhaps use a local variable for RB_PARENT(old, field)?

This revision is now accepted and ready to land.May 18 2020, 2:49 PM

Use a local variable for RB_PARENT(old, field).

This revision now requires review to proceed.May 18 2020, 7:15 PM

I ran all but the last 7 stress2 tests on D24845.71808.diff without seeing any problems.
I'm now switching to D24845.71955.diff

This revision is now accepted and ready to land.May 19 2020, 1:43 PM

I completed a full stress2 test of D24845.71955.diff. No problems seen except for this known iflib problem: https://people.freebsd.org/~pho/stress/log/dougm070.txt