Page MenuHomeFreeBSD

Simplify leaf_alloc, improve some hints
ClosedPublic

Authored by dougm on Dec 4 2019, 6:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 12, 2:33 PM
Unknown Object (File)
Sun, Dec 8, 11:36 PM
Unknown Object (File)
Nov 21 2024, 6:20 AM
Unknown Object (File)
Nov 15 2024, 2:26 PM
Unknown Object (File)
Oct 22 2024, 1:05 PM
Unknown Object (File)
Sep 17 2024, 1:00 PM
Unknown Object (File)
Sep 15 2024, 11:41 PM
Unknown Object (File)
Sep 15 2024, 11:41 PM
Subscribers

Details

Summary

Simplify the processing a leaf mask to find big-enough ranges of set bits, by storing and modifying the complement of the original leaf mask, and by avoiding some unnecessary intermediate variables in computing the shift amounts. The logic is similar to what has recently been committed to sys/sys/bitstring.h.

Compute better hint updates for the case when the cursor starts in mid-leaf, and eliminates some otherwise viable solutions. Assume the worst case, that all the eliminated offsets could have been solutions, and you can still compute a better hint than we use now.

Diff Detail

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

Event Timeline

On the whole, this is okay. Just ask Peter to test it.

sys/kern/subr_blist.c
724 ↗(On Diff #65199)

With modern compilers, there is no machine-level benefit to using a predecrement operation within this expression.

787–790 ↗(On Diff #65199)

This is creating conditional control flow where it doesn't need to exist. In such a simple, the compiler figures this out, and avoids the compare-and-branch.

dougm marked 2 inline comments as done.
dougm added a subscriber: pho.

Apply reviewer's suggestions.

I ran tests for 20 hours on D22666.65577.diff without seeing any problems.

This revision is now accepted and ready to land.Dec 14 2019, 6:21 PM