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)
Sat, Jun 1, 6:33 AM
Unknown Object (File)
Fri, May 31, 5:52 AM
Unknown Object (File)
Apr 4 2024, 8:40 PM
Unknown Object (File)
Mar 17 2024, 8:20 AM
Unknown Object (File)
Jan 26 2024, 1:20 PM
Unknown Object (File)
Dec 23 2023, 12:35 AM
Unknown Object (File)
Nov 29 2023, 4:28 AM
Unknown Object (File)
Oct 5 2023, 2:00 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